diff options
| author | l3wdfut4pwr <l3wdfut4pwr@gmail.com> | 2026-04-03 23:59:33 +0300 |
|---|---|---|
| committer | l3wdfut4pwr <l3wdfut4pwr@gmail.com> | 2026-04-03 23:59:33 +0300 |
| commit | 9c65a9c271dfda5ea17c9d909bc9e7e6d0c040ab (patch) | |
| tree | 9df45f5df63fb509e1b7cdac81659c4713287d70 /src/lib/contexts | |
| parent | 1d20080db8a26e4b7dd4071daac1166142592afa (diff) | |
add profile
Diffstat (limited to 'src/lib/contexts')
| -rw-r--r-- | src/lib/contexts/Auth.context.tsx | 30 |
1 files changed, 29 insertions, 1 deletions
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(); |
