From ffbeed38434ece7be28acdf7e3bd900c801a636d Mon Sep 17 00:00:00 2001
From: physcik <mynameisgennadiy@vk.com>
Date: Thu, 7 May 2026 15:44:45 +0500
Subject: Ranged weapons edit page

---
 front/src/App.tsx | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

(limited to 'front/src/App.tsx')

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
@@ -33,14 +33,15 @@ const router = createBrowserRouter([
         path: "/weapons",
         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 (
-- 
cgit v1.3

