mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-14 00:01:03 +00:00
fix(storage): let the app boot with the reclaim routes and keep the ratchets where they were
The two admin routes go on the managed allow list, without which buildApp refused to start. The reclaim calls move to their own api module so client.ts stays at its size, the phone card sizes its text through the type tiers, and the tests drop a hand-built service, a non-null assertion and a promise read as a boolean.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import type { StorageAdminState, StorageBackend, StorageConfig, StorageConfigPut, StorageTestResponse } from '@trek/shared'
|
||||
import { adminApi } from '../../../api/client'
|
||||
import { storageReclaimApi } from '../../../api/storageReclaim'
|
||||
import { getApiErrorMessage, type ApiError } from '../../../types'
|
||||
import { settingsDocumentOf } from './storageModel'
|
||||
|
||||
@@ -371,7 +372,7 @@ export function useStorageAdmin(genericError: string, conflictError: string): St
|
||||
|
||||
const setReclaimDelete = useCallback(async (enabled: boolean): Promise<string | null> => {
|
||||
try {
|
||||
setReclaim(await adminApi.setStorageReclaimDelete(enabled))
|
||||
setReclaim(await storageReclaimApi.setDelete(enabled))
|
||||
return null
|
||||
} catch (err: unknown) {
|
||||
return getApiErrorMessage(err, genericError)
|
||||
@@ -380,7 +381,7 @@ export function useStorageAdmin(genericError: string, conflictError: string): St
|
||||
|
||||
const checkReclaim = useCallback(async (): Promise<string | null> => {
|
||||
try {
|
||||
const lastRun = await adminApi.runStorageReclaimCheck()
|
||||
const lastRun = await storageReclaimApi.check()
|
||||
setReclaim({ deleteEnabled: stateRef.current?.reclaim?.deleteEnabled ?? false, lastRun })
|
||||
return null
|
||||
} catch (err: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user