feat(trash): frontend trash API client + Pinia store
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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}`);
|
||||
}
|
||||
Reference in New Issue
Block a user