Import login route from default theme

This commit is contained in:
2021-05-11 17:57:29 +02:00
parent 1b683d7b77
commit b2a1369038
6 changed files with 156 additions and 9 deletions

View File

@ -55,7 +55,7 @@ export class AsyncWidget extends React.Component<AsyncWidgetProperties, AsyncWid
render() {
if (this.state.status == Status.ERROR)
if (this.state.status === Status.ERROR)
return (<div style={{
display: "flex",
alignItems: "center",
@ -73,7 +73,7 @@ export class AsyncWidget extends React.Component<AsyncWidgetProperties, AsyncWid
</Paper>
</div>);
if(this.state.status == Status.SUCCESS)
if(this.state.status === Status.SUCCESS)
return this.props.onBuild();
return (<CenterCircularProgress></CenterCircularProgress>)

View File

@ -5,24 +5,33 @@
*/
import React from "react";
import { AccountHelper } from "../../helpers/AccountHelper";
import { LoginRoute } from "../routes/LoginRoute";
import { AsyncWidget } from "./AsyncWidget";
interface InitWidgetState {
signedIn: boolean,
}
export class InitWidget extends React.Component {
export class InitWidget extends React.Component<{}, InitWidgetState> {
constructor(props: any) {
super(props);
this.state = {
signedIn: false
};
this.init = this.init.bind(this);
this.build = this.build.bind(this);
}
async init() {
await new Promise((res, rej) => {
setTimeout(() => {
rej(null);
}, 500)
})
this.setState({ signedIn: false });
if (AccountHelper.hasAccessToken) {
throw Error("UNIMPLEMENTED!");
}
}
render() {
@ -34,6 +43,6 @@ export class InitWidget extends React.Component {
}
build() {
return (<div>yes !!! done !!!</div>);
return this.state.signedIn ? null : (<LoginRoute></LoginRoute>);
}
}