diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-16 14:51:20 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-16 14:51:20 +0100 |
commit | 3fc06ea736283ad38bb51b932ab0e91dae081159 (patch) | |
tree | 240333b103ac9bd7834db00a0d18c40983acb366 /pages | |
parent | 664ce3e6369b3ae306735f55aa2ac66a8d8654d9 (diff) |
home pagina "gefixt"
Diffstat (limited to 'pages')
-rw-r--r-- | pages/index.tsx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index b3e0e1f..9c56f52 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -63,20 +63,19 @@ export default class HomePage extends Component { getUserInfo () { axios.request<userInfo>({ method: "get", - url: `${window.location.origin}/api/user/info`, + url: `/api/user/info`, headers: {"content-type": "application/json"} }) - .then(request => this.setState({ info: request.data })) + .then(request => this.setState({ + info: request.data, + loggedIn: request.data == {} + })) .catch(console.log); } constructor(props: {}) { super(props); - - useEffect(() => { - this.setState({ loggedIn: document.cookie.includes("token") }) - if(this.state.loggedIn) this.getUserInfo() - }) + this.getUserInfo(); } render () { |