feat: redirect to oauth with js

This commit is contained in:
EnixCoda 2019-08-24 22:08:30 +08:00
parent 333898d677
commit e133c998ac
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -232,9 +232,14 @@ export default class SettingsBar extends React.PureComponent<Props, State> {
</h4>
{!hasAccessToken && (
<a
href={`https://github.com/login/oauth/authorize?client_id=${
oauth.clientId
}&scope=repo&redirect_uri=${encodeURIComponent(window.location.href)}`}
href="#"
onClick={() => {
// use js here to make sure redirect_uri is latest url
const url = `https://github.com/login/oauth/authorize?client_id=${
oauth.clientId
}&scope=repo&redirect_uri=${encodeURIComponent(window.location.href)}`
window.location.href = url
}}
>
Create with OAuth
</a>