file control panel

This commit is contained in:
Roman Hergenreder 2021-01-07 22:01:56 +01:00
parent 7a603d7d90
commit 4fa8c7bf80
2 changed files with 13 additions and 6 deletions

@ -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 <></>;
}