frontend phase 15

This commit is contained in:
hamid
2026-07-10 20:28:06 +03:30
parent bc51cf59b4
commit 70cf00ce4a
151 changed files with 10711 additions and 44 deletions
@@ -0,0 +1,21 @@
import { useQuery } from '@tanstack/react-query';
import { verificationApi } from '../apis';
import { verificationKeys } from '../keys';
import { SIGNED_DOCUMENT_URL_GC_TIME, SIGNED_DOCUMENT_URL_STALE_TIME } from '../constants';
/**
* A document's **short-lived signed GET URL**, fetched on demand when the viewer opens a document (pass
* `null` while none is open). Short `staleTime` + short `gcTime` keep the URL out of long-term cache — a
* reopen re-signs a fresh URL rather than reusing an expired one. `retry: false`: a failed/expired sign is
* surfaced to the viewer's error/re-request path, not silently re-hammered.
*/
export function useVerificationDocumentUrl(documentId: number | null) {
return useQuery({
queryKey: verificationKeys.adminDocumentUrl(documentId ?? -1),
queryFn: () => verificationApi.getDocumentSignedUrl(documentId as number),
enabled: documentId != null,
staleTime: SIGNED_DOCUMENT_URL_STALE_TIME,
gcTime: SIGNED_DOCUMENT_URL_GC_TIME,
retry: false,
});
}