From 60c6c6530aabd8f9b33f863da04e976f992214a2 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Mon, 25 Apr 2022 13:24:53 +0200 Subject: [PATCH] oops, forgot to disable test user --- src/client/src/FrontPage.js | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/client/src/FrontPage.js b/src/client/src/FrontPage.js index 7f39591..36a9a8b 100644 --- a/src/client/src/FrontPage.js +++ b/src/client/src/FrontPage.js @@ -205,36 +205,36 @@ let showError = (message) => {}; export default function App() { const [user, setUser] = React.useState({}); - // let fetchUser = () => { - // fetch(process.env.REACT_APP_API_URL + `/users/getSavedUser`) - // .then(res => res.json()) - // .then(data => { - // if (data.status !== "OK") { - // setUser({ isManager: false, isLoggedIn: false }); - // console.log(data.data); // "No user logged in" - // return; - // } - // let u = data.data; - // u.isLoggedIn = true; - // console.log("User is logged in") - // setUser(u); - // }) - // .catch((err) => { - // showError(err.message); - // setUser({ isManager: false, isLoggedIn: false }); - // }); - // } - // // Debug mode, allow all: let fetchUser = () => { - setUser({ - name: "TEST USERTEST", - isManager: true, - isLoggedIn: true, - email: "testesen@gmail.com", - asuraId: "123456789", - googleId: "234" - }); + fetch(process.env.REACT_APP_API_URL + `/users/getSavedUser`) + .then(res => res.json()) + .then(data => { + if (data.status !== "OK") { + setUser({ isManager: false, isLoggedIn: false }); + console.log(data.data); // "No user logged in" + return; + } + let u = data.data; + u.isLoggedIn = true; + console.log("User is logged in") + setUser(u); + }) + .catch((err) => { + showError(err.message); + setUser({ isManager: false, isLoggedIn: false }); + }); } + // // Debug mode, allow all: + // let fetchUser = () => { + // setUser({ + // name: "TEST USERTEST", + // isManager: true, + // isLoggedIn: true, + // email: "testesen@gmail.com", + // asuraId: "123456789", + // googleId: "234" + // }); + // } React.useEffect(() => { fetchUser();