Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion apps/mobile/src/context/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import { get } from '../services/api';
import { DEMO_TOKEN } from '../services/api';

// ── Storage Keys ──────────────────────────────────────────────────────────

// ── Storage Keys ──────────────────────────────────────────────────────────────

const TOKEN_KEY = 'devcard.auth.token';
const FIRST_LAUNCH_KEY = 'devcard.firstLaunch';

// ── Types ────────────────────────────────────────────────────────────
// ── Types ─────────────────────────────────────────────────────────────────────

interface User {
Expand Down Expand Up @@ -36,6 +39,8 @@ interface AuthContextType {
enterDemoMode: () => Promise<void>;
}

// ── Context ───────────────────────────────────────────────────────────

// ── Context ───────────────────────────────────────────────────────────────────

const AuthContext = createContext<AuthContextType | undefined>(undefined);
Expand Down Expand Up @@ -98,6 +103,9 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}
}, []);

// ── Logout ──


// ── Logout ──

const logout = useCallback(async () => {
Expand All @@ -110,6 +118,10 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}
}, []);

// ── Refresh User ──



// ── Refresh User ──

const refreshUser = useCallback(async () => {
Expand Down Expand Up @@ -152,4 +164,4 @@ export function useAuth(): AuthContextType {
throw new Error('useAuth must be used within an AuthProvider');
}
return context;
}
}