SEction 4 completeed

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-27 02:59:27 +00:00
parent 178b7c23ce
commit 74a3441ee4
6 changed files with 326 additions and 446 deletions

View File

@@ -818,6 +818,45 @@ export async function updateAccountSettings(data: Partial<AccountSettings>): Pro
});
}
// ============================================================================
// PROFILE & SECURITY
// ============================================================================
export interface UserProfile {
id: number;
email: string;
username?: string;
first_name: string;
last_name: string;
phone?: string;
timezone?: string;
language?: string;
email_notifications?: boolean;
marketing_emails?: boolean;
}
export async function getUserProfile(): Promise<{ user: UserProfile }> {
return fetchAPI('/v1/auth/me/');
}
export async function updateUserProfile(data: Partial<UserProfile>): Promise<{ user: UserProfile }> {
// User profile updates go through users endpoint
return fetchAPI('/v1/auth/users/me/', {
method: 'PATCH',
body: JSON.stringify(data),
});
}
export async function changePassword(oldPassword: string, newPassword: string): Promise<{ message: string }> {
return fetchAPI('/v1/auth/change-password/', {
method: 'POST',
body: JSON.stringify({
old_password: oldPassword,
new_password: newPassword,
}),
});
}
export interface UsageAnalytics {
period_days: number;
start_date: string;