file control panel
This commit is contained in:
parent
7a603d7d90
commit
4fa8c7bf80
@ -1,6 +1,7 @@
|
||||
import 'babel-polyfill';
|
||||
|
||||
export default class API {
|
||||
|
||||
constructor() {
|
||||
this.loggedIn = false;
|
||||
this.user = { };
|
||||
@ -19,12 +20,7 @@ export default class API {
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
let res = await response.json();
|
||||
if (!res.success && res.msg === "You are not logged in.") {
|
||||
document.location.reload();
|
||||
}
|
||||
|
||||
return res;
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async fetchUser() {
|
||||
|
@ -13,6 +13,17 @@ class FileControlPanel extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
if (!this.state.loadend) {
|
||||
this.api.fetchUser().then(() => {
|
||||
this.setState({ ...this.state, loaded: true });
|
||||
});
|
||||
} else if (this.state.user.loggedIn) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user