Initial
This commit is contained in:
commit
b43955e0d9
162 changed files with 15425 additions and 0 deletions
20
src/lib/api/profile.ts
Normal file
20
src/lib/api/profile.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { api } from './client';
|
||||
|
||||
export interface UserProfile {
|
||||
username: string;
|
||||
email: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
}
|
||||
|
||||
export type ProfilePatch = Partial<Pick<UserProfile, 'email' | 'first_name' | 'last_name'>>;
|
||||
|
||||
export const profileApi = {
|
||||
get: () => api.get<UserProfile>('/profile/'),
|
||||
update: (patch: ProfilePatch) => api.patch<UserProfile>('/profile/', patch),
|
||||
changePassword: (old_password: string, new_password: string) =>
|
||||
api.post<{ detail: string }>('/profile/change-password/', { old_password, new_password }),
|
||||
deleteData: () => api.del<{ detail: string }>('/profile/delete-data/'),
|
||||
deleteAccount: (password: string) =>
|
||||
api.del<{ detail: string }>('/profile/delete-account/', { password })
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue