diff options
Diffstat (limited to 'front/src/App.tsx')
| -rw-r--r-- | front/src/App.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/front/src/App.tsx b/front/src/App.tsx index da9cbfd..c3d4b00 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -34,13 +34,14 @@ const router = createBrowserRouter([ element: (<WeaponsIndex />), }, { - path: "/weapons/:id", - element: (<RangedWeaponPage />), - }, - { path: "/weapons/:id/edit", + errorElement: (<ErrorHandler />), element: (<EditRangedWeaponPage />), }, + { + path: "/weapons/:id", + element: (<RangedWeaponPage />), + }, // auth { @@ -69,7 +70,14 @@ function App() { const [authCookie, ] = useCookies(['X-AUTH-TOKEN']); const [auth, setAuth] = useState<User | null>(null); useEffect(() => { - GetUserInfo(authCookie['X-AUTH-TOKEN']).then(v => setAuth(v)); + GetUserInfo(authCookie['X-AUTH-TOKEN']).then( + v => { + console.log(v); + if (!v || v == undefined) + document.cookie = "X-AUTH-TOKEN=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; + setAuth(v); + } + ); }, []); return ( |
