Skip to content

Commit

Permalink
Merge pull request #57 from WildCodeSchool/making-better-database
Browse files Browse the repository at this point in the history
faking admin
  • Loading branch information
mahdimcheik authored Mar 6, 2024
2 parents 707cd92 + 479690b commit 65bfb0b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions frontend/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ const router = createBrowserRouter([

let loaderData = null;

try {
if (localStorage.getItem("token")) {
const { data } = await axios.get(
`${import.meta.env.VITE_BACKEND_URL}/api/getprofile`
);
loaderData = data;
}
} catch (err) {
console.error(err.message);
}
// try {
// if (localStorage.getItem("token")) {
// const { data } = await axios.get(
// `${import.meta.env.VITE_BACKEND_URL}/api/getprofile`
// );
// loaderData = data;

// }
// } catch (err) {
// console.error(err.message);
// }
loaderData = { isAdmin: 1 };
return { loaderData };
},
element: (
Expand Down

0 comments on commit 65bfb0b

Please sign in to comment.