From 9c65a9c271dfda5ea17c9d909bc9e7e6d0c040ab Mon Sep 17 00:00:00 2001 From: l3wdfut4pwr Date: Fri, 3 Apr 2026 23:59:33 +0300 Subject: add profile --- src/lib/contexts/Auth.context.tsx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/lib/contexts') diff --git a/src/lib/contexts/Auth.context.tsx b/src/lib/contexts/Auth.context.tsx index fbf2e24..4e567ba 100644 --- a/src/lib/contexts/Auth.context.tsx +++ b/src/lib/contexts/Auth.context.tsx @@ -4,12 +4,38 @@ import React, { createContext, useState, useContext, useEffect } from 'react'; export type User = { id: number; username: string; + email: string; + password?: string; avatar?: string; banner_file?: string; + description?: string; premium?: boolean; is_banned?: boolean; is_moderator?: boolean; + token_version?: number; + profile?: { + id: number; + user_id: number; + avatar_file?: string; + banner_file?: string; + description?: string; + publications_count?: number; + collections_count?: number; + subscriptions_count?: number; + followers_count?: number; + following_count?: number; + }; + integrations?: { + facebook?: string | null; + pinterest?: string | null; + discord?: string | null; + artstation?: string | null; + x?: string | null; // Twitter/X + behance?: string | null; + instagram?: string | null; + }; }; + interface AuthContextType { user: User | null; setUser: (user: User | null) => void; @@ -33,7 +59,9 @@ export const AuthContextProvider = ({ children }: React.PropsWithChildren) => { if (!res.ok) return; const userData = await res.json(); setUser(userData); - } catch {} + } catch (err) { + console.error('Error fetching user:', err); + } }; fetchUser(); -- cgit v1.3-3-g829e