diff --git a/fileControlPanel/src/api.js b/fileControlPanel/src/api.js index 383c479..d55a8fb 100644 --- a/fileControlPanel/src/api.js +++ b/fileControlPanel/src/api.js @@ -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() { diff --git a/fileControlPanel/src/index.js b/fileControlPanel/src/index.js index 432ddc8..8e1d5aa 100644 --- a/fileControlPanel/src/index.js +++ b/fileControlPanel/src/index.js @@ -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 <>; }