SEction 4 completeed
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user