forked from JonasFranzDEV/gitea-github-migrator
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
845 B
39 lines
845 B
import * as React from "react";
|
|
import { Button, Icon } from "semantic-ui-react";
|
|
import { client } from "../configuration";
|
|
|
|
export interface IGitHubButtonState {
|
|
loading: boolean;
|
|
}
|
|
|
|
export class GitHubButton extends React.Component<{}, IGitHubButtonState> {
|
|
constructor(props: {}) {
|
|
super(props);
|
|
this.state = {
|
|
loading: false
|
|
};
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Button
|
|
icon
|
|
loading={this.state.loading}
|
|
disabled={this.state.loading}
|
|
labelPosition="left"
|
|
onClick={this.submitToGitHub}
|
|
>
|
|
<Icon name="github" />
|
|
Login with GitHub
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
submitToGitHub() {
|
|
this.setState({ loading: true });
|
|
client.getGitHubRedirect().then(res => {
|
|
this.setState({ loading: false });
|
|
window.location.href = res.url;
|
|
});
|
|
}
|
|
}
|
|
|