add local file serach in to header menu
This commit is contained in:
@@ -2,6 +2,34 @@ import { QueryClient } from '@tanstack/react-query';
|
||||
import { getUserData, getUserFilesInfo, getBuildData } from '@/app/actions/action';
|
||||
import { getUserFilesData } from '@/app/actions/fileEntity';
|
||||
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
||||
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
||||
|
||||
export interface allFilesExtensions {
|
||||
videos: string[];
|
||||
audios: string[];
|
||||
images: string[];
|
||||
documents: string[];
|
||||
maxFileSize: number;
|
||||
}
|
||||
|
||||
export async function getAllFilesExtensions(): Promise<allFilesExtensions> {
|
||||
const [video, audio, image, document] = await Promise.all([
|
||||
getAllowedFilesExtensions('video'),
|
||||
getAllowedFilesExtensions('audio'),
|
||||
getAllowedFilesExtensions('image'),
|
||||
getAllowedFilesExtensions('document')
|
||||
]);
|
||||
|
||||
const result: allFilesExtensions = {
|
||||
videos: video?.file_extension ? video.file_extension : [],
|
||||
audios: audio?.file_extension ? audio.file_extension : [],
|
||||
images: image?.file_extension ? image.file_extension : [],
|
||||
documents: document?.file_extension ? document.file_extension : [],
|
||||
maxFileSize: video?.max_file_size ? video.max_file_size : 0
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function prefetchLayoutQueries(queryClient: QueryClient) {
|
||||
await Promise.all([
|
||||
@@ -35,5 +63,10 @@ export async function prefetchLayoutQueries(queryClient: QueryClient) {
|
||||
}
|
||||
}
|
||||
}),
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ['allFilesExtensions'],
|
||||
queryFn: () => getAllFilesExtensions(),
|
||||
staleTime: 5 * 60 * 1000
|
||||
}),
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user