From 646c1168349643eb01db53b5e06bf986a16b86d7 Mon Sep 17 00:00:00 2001
From: l3wdfut4pwr <l3wdfut4pwr@gmail.com>
Date: Tue, 17 Mar 2026 14:06:58 +0200
Subject: simple registration prototype

---
 src/lib/contexts/Auth.context.tsx | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 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 ff2d369..d93ca92 100644
--- a/src/lib/contexts/Auth.context.tsx
+++ b/src/lib/contexts/Auth.context.tsx
@@ -1,36 +1,33 @@
 'use client';
-
-import React, { createContext, use } from 'react';
-
+import React, { createContext, use, useState, useContext } from 'react';
 type User = {
-    id: string;
-    avatar?: string;
-    // Чёто там ещё
+    id: number;
+    username: string;
 };
 
-interface AuthContext {
+interface AuthContextType {
     user: User | null;
+    setUser: (user: User | null) => void;
 }
 
 const AuthContext = createContext<AuthContext | null>(null);
 
 export const AuthContextProvider = ({ children }: React.PropsWithChildren) => {
-    // TODO: подключить бэк
-    const user = null;
+    const [user, setUser] = useState<User | null>(null);
+
     return (
-        <AuthContext.Provider value={{ user }}>{children}</AuthContext.Provider>
+        <AuthContext.Provider value={{ user, setUser }}>
+            {children}
+        </AuthContext.Provider>
     );
 };
 
 export const useAuthContext = () => {
-    const context = use(AuthContext);
-
-    if (!context) {
+    const context = useContext(AuthContext);
+    if (!context)
         throw new Error(
             'useAuthContext must be used within AuthContextProvider',
         );
-    }
-
     return context;
 };
 
-- 
cgit v1.3-3-g829e

