feat(compliance): G1-b frontend DSAR status UI — 4th subtab in ComplianceTab: type selection (Art.15/17/16), person picker, direct GDPR export download, two-step deletion confirmation; uses existing system-settings DSAR endpoints
This commit is contained in:
@@ -145,3 +145,41 @@ export async function updateRetentionPolicy(
|
||||
{ days }
|
||||
);
|
||||
}
|
||||
|
||||
// ─── DSAR (GDPR Art. 15/17/20) ───
|
||||
|
||||
export type DsarType = 'access' | 'deletion' | 'rectification';
|
||||
|
||||
export interface DsarRequestResponse {
|
||||
job_id: string;
|
||||
status: string;
|
||||
type: DsarType;
|
||||
user_id: string;
|
||||
}
|
||||
|
||||
/** Queue a DSAR job for a user. Admin only. */
|
||||
export async function submitDsarRequest(
|
||||
userId: string,
|
||||
type: DsarType
|
||||
): Promise<DsarRequestResponse> {
|
||||
return apiPost<DsarRequestResponse>(`/system-settings/dsar/${userId}`, {
|
||||
type,
|
||||
});
|
||||
}
|
||||
|
||||
/** Stream the full GDPR data export for a user and trigger a browser download. */
|
||||
export async function downloadDsgvoExport(userId: string, userName?: string): Promise<void> {
|
||||
const response = await apiGet<Blob>(`/system-settings/dsgvo-export/${userId}`, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
const blob = new Blob([response], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
const safeName = (userName ?? userId).replace(/[^a-z0-9_-]/gi, '_');
|
||||
link.download = `dsgvo_export_${safeName}.json`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user