This commit is contained in:
rustmailer
2026-03-25 17:26:57 +08:00
parent a41b5417e3
commit 5d0039cb74
24 changed files with 227 additions and 77 deletions
+4 -4
View File
@@ -1,14 +1,14 @@
import { AttachmentMetadata, get_attachment_meta } from '@/api/mailbox/envelope/api';
import { useQuery, UseQueryOptions } from '@tanstack/react-query';
import { get_attachment_meta } from '@/api/mailbox/envelope/api';
import { useQuery } from '@tanstack/react-query';
export const ATTACHMENT_METADATA_KEY = ['attachment_metadata'] as const;
export const useAttachmentMetadata = (options?: Partial<UseQueryOptions<AttachmentMetadata>>) => {
export const useAttachmentMetadata = (enabled = true) => {
return useQuery({
queryKey: ATTACHMENT_METADATA_KEY,
queryFn: get_attachment_meta,
staleTime: 1000 * 60 * 10,
gcTime: 1000 * 60 * 30,
...options,
enabled: enabled
});
};