mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 07:40:59 +00:00
9d2ffc91af
Confirm sends the count the admin saw and waits for its answer; a stale count reloads the state. A running backup is named as a skip reason, a missing installation id and a stale count as errors, and the switch's hint no longer promises removal right away: deleted files go a day later, once no undo can bring them back. Strings in all 28 languages.
16 lines
989 B
TypeScript
16 lines
989 B
TypeScript
import type { StorageReclaimConfirmRequest, StorageReclaimState } from '@trek/shared';
|
|
import { apiClient } from './client';
|
|
|
|
/** Admin > Storage, unreferenced files: the nightly deletion switch, a check on demand, and the large-share confirmation. */
|
|
export const storageReclaimApi = {
|
|
setDelete: (deleteEnabled: boolean): Promise<StorageReclaimState> =>
|
|
apiClient.put('/admin/storage/reclaim', { deleteEnabled }).then((r) => r.data),
|
|
/** Starts a report-only check in the background (202); its report arrives through the admin state. */
|
|
check: (): Promise<{ started: true }> => apiClient.post('/admin/storage/reclaim/run').then((r) => r.data),
|
|
/** `unreferenced` is the count the admin was shown: the server refuses when its own count has moved on. */
|
|
confirm: (request: StorageReclaimConfirmRequest): Promise<StorageReclaimState> =>
|
|
apiClient
|
|
.post('/admin/storage/reclaim/confirm', request satisfies StorageReclaimConfirmRequest)
|
|
.then((r) => r.data),
|
|
};
|