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'; import 'babel-polyfill';
export default class API { export default class API {
constructor() { constructor() {
this.loggedIn = false; this.loggedIn = false;
this.user = { }; this.user = { };
@ -19,12 +20,7 @@ export default class API {
body: JSON.stringify(params) body: JSON.stringify(params)
}); });
let res = await response.json(); return await response.json();
if (!res.success && res.msg === "You are not logged in.") {
document.location.reload();
}
return res;
} }
async fetchUser() { async fetchUser() {

@ -13,6 +13,17 @@ class FileControlPanel extends React.Component {
} }
render() { render() {
if (!this.state.loadend) {
this.api.fetchUser().then(() => {
this.setState({ ...this.state, loaded: true });
});
} else if (this.state.user.loggedIn) {
} else {
}
return <></>; return <></>;
} }