From d3bceed42caca6ac8c39ebe0c929f7d3c13d2bfa Mon Sep 17 00:00:00 2001
From: l3wdfut4pwr <l3wdfut4pwr@gmail.com>
Date: Thu, 9 Apr 2026 15:20:56 +0300
Subject: update settings

---
 src/lib/contexts/Auth.context.tsx | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'src/lib/contexts/Auth.context.tsx')

diff --git a/src/lib/contexts/Auth.context.tsx b/src/lib/contexts/Auth.context.tsx
index 4e567ba..127c942 100644
--- a/src/lib/contexts/Auth.context.tsx
+++ b/src/lib/contexts/Auth.context.tsx
@@ -5,7 +5,8 @@ export type User = {
     id: number;
     username: string;
     email: string;
-    password?: string;
+    password: boolean;
+    google_id?: string | null;
     avatar?: string;
     banner_file?: string;
     description?: string;
@@ -49,18 +50,19 @@ export const AuthContextProvider = ({ children }: React.PropsWithChildren) => {
 
     useEffect(() => {
         const fetchUser = async () => {
-            const hasCookies = document.cookie.includes('access_token');
-            if (!hasCookies) return;
-
             try {
                 const res = await fetch(`${API_URL}/api/me`, {
                     credentials: 'include',
                 });
-                if (!res.ok) return;
-                const userData = await res.json();
-                setUser(userData);
+                if (!res.ok) {
+                    setUser(null);
+                    return;
+                }
+                const data = await res.json();
+                setUser(data.authenticated ? data.user : null);
             } catch (err) {
                 console.error('Error fetching user:', err);
+                setUser(null);
             }
         };
 
-- 
cgit v1.3-3-g829e

