2025-11-23 13:29:31 +00:00
|
|
|
// Authentication Response Models
|
|
|
|
|
export interface AuthTokens {
|
|
|
|
|
access: string;
|
|
|
|
|
refresh: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface User {
|
|
|
|
|
id: number;
|
|
|
|
|
email: string;
|
|
|
|
|
first_name: string;
|
|
|
|
|
last_name: string;
|
|
|
|
|
phone_number?: string;
|
|
|
|
|
is_admin?: boolean;
|
2025-11-23 21:13:18 +00:00
|
|
|
isAdmin?: boolean; // API uses camelCase
|
|
|
|
|
is_staff?: boolean;
|
|
|
|
|
isStaff?: boolean; // API uses camelCase
|
|
|
|
|
is_superuser?: boolean;
|
|
|
|
|
isSuperuser?: boolean; // API uses camelCase
|
2025-11-23 13:29:31 +00:00
|
|
|
is_verified?: boolean;
|
|
|
|
|
isVerified?: boolean; // API uses camelCase
|
2025-11-23 21:13:18 +00:00
|
|
|
is_active?: boolean;
|
|
|
|
|
isActive?: boolean; // API uses camelCase
|
2025-11-23 13:29:31 +00:00
|
|
|
date_joined?: string;
|
2025-11-23 21:13:18 +00:00
|
|
|
last_login?: string;
|
2025-11-23 13:29:31 +00:00
|
|
|
created_at?: string;
|
|
|
|
|
updated_at?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AuthResponse {
|
|
|
|
|
message?: string;
|
|
|
|
|
access?: string; // Tokens can be at root level
|
|
|
|
|
refresh?: string; // Tokens can be at root level
|
|
|
|
|
tokens?: AuthTokens; // Or nested in tokens object
|
|
|
|
|
user?: User;
|
|
|
|
|
detail?: string;
|
|
|
|
|
error?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ApiError {
|
|
|
|
|
detail?: string;
|
|
|
|
|
message?: string;
|
|
|
|
|
error?: string;
|
|
|
|
|
email?: string[];
|
|
|
|
|
password?: string[];
|
|
|
|
|
password2?: string[];
|
|
|
|
|
otp?: string[];
|
|
|
|
|
[key: string]: string | string[] | undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token Storage Keys
|
|
|
|
|
export const TOKEN_STORAGE_KEYS = {
|
|
|
|
|
ACCESS_TOKEN: "auth_access_token",
|
|
|
|
|
REFRESH_TOKEN: "auth_refresh_token",
|
|
|
|
|
USER: "auth_user",
|
|
|
|
|
} as const;
|
|
|
|
|
|