This commit is contained in:
lendry
2026-06-25 08:31:36 +03:00
parent 71b270fcb3
commit 933f7fb9e1
22 changed files with 1871 additions and 620 deletions

View File

@@ -562,8 +562,36 @@ export async function fetchDocumentPhotoUrl(userId: string, storageKey: string,
return apiFetch<MediaAccessResponse>(`/media/users/${userId}/documents/photo-url?${query.toString()}`, {}, token);
}
export interface AccountDeletionStatus {
pending: boolean;
deletionRequestedAt?: string;
effectiveAt?: string;
graceDays: number;
}
export async function requestAccountDeletion(userId: string, token?: string | null) {
return apiFetch<AccountDeletionStatus & { userId: string }>(
`/profile/users/${userId}/self-delete`,
{ method: 'POST' },
token
);
}
export async function cancelAccountDeletion(userId: string, token?: string | null) {
return apiFetch<{ userId: string; cancelled: boolean }>(
`/profile/users/${userId}/self-delete/cancel`,
{ method: 'POST' },
token
);
}
export async function fetchAccountDeletionStatus(userId: string, token?: string | null) {
return apiFetch<AccountDeletionStatus>(`/profile/users/${userId}/self-delete/status`, {}, token);
}
/** @deprecated Используйте requestAccountDeletion — удаление теперь отложенное */
export async function softDeleteProfile(userId: string, token?: string | null) {
return apiFetch<{ success: boolean }>(`/profile/users/${userId}/self-delete`, { method: 'POST' }, token);
return requestAccountDeletion(userId, token);
}
export interface UserAddress {
@@ -726,6 +754,10 @@ export async function updateFamilyGroup(groupId: string, name: string, token?: s
return apiFetch<FamilyGroup>(`/family/groups/${groupId}`, { method: 'PATCH', body: JSON.stringify({ name }) }, token);
}
export async function deleteFamilyGroup(groupId: string, token?: string | null) {
return apiFetch<{ count: number }>(`/family/groups/${groupId}`, { method: 'DELETE' }, token);
}
export async function sendFamilyInvite(groupId: string, payload: { inviteeUserId: string; target?: string }, token?: string | null) {
return apiFetch<FamilyInvite>(`/family/groups/${groupId}/invites`, { method: 'POST', body: JSON.stringify(payload) }, token);
}