mirror of
https://gitlab.com/comunic/comunicconsole
synced 2025-07-07 18:42:49 +00:00
Import login route from default theme
This commit is contained in:
@ -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>)
|
||||
|
@ -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>);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user