29 lines
674 B
TypeScript
29 lines
674 B
TypeScript
import { apiGet, apiPost, apiDelete } from "@/api/client";
|
|
|
|
export interface TrashItem {
|
|
type: string;
|
|
id: number;
|
|
title: string;
|
|
}
|
|
|
|
export interface TrashBatch {
|
|
batch_id: string;
|
|
deleted_at: string | null;
|
|
summary: string;
|
|
count: number;
|
|
items: TrashItem[];
|
|
}
|
|
|
|
export async function listTrash(): Promise<TrashBatch[]> {
|
|
const data = await apiGet<{ batches: TrashBatch[] }>("/api/trash");
|
|
return data.batches;
|
|
}
|
|
|
|
export async function restoreBatch(batchId: string): Promise<void> {
|
|
await apiPost(`/api/trash/${batchId}/restore`, {});
|
|
}
|
|
|
|
export async function purgeBatch(batchId: string): Promise<void> {
|
|
return apiDelete(`/api/trash/${batchId}`);
|
|
}
|