diff --git a/client/screens/FileViewScreen.tsx b/client/screens/FileViewScreen.tsx index 161be2b..ed4ae09 100644 --- a/client/screens/FileViewScreen.tsx +++ b/client/screens/FileViewScreen.tsx @@ -17,7 +17,7 @@ type RenderItemProps = { item: FileViewProps; }; -function FileViewScreen() { +export default function FileViewScreen() { const { group } = useCareWalletContext(); const { data, refetch, isFetching } = useAllFileByGroup(group.groupID); @@ -56,4 +56,3 @@ function FileViewScreen() { ); } -export default FileViewScreen; diff --git a/client/services/file.ts b/client/services/file.ts index 5be93ea..705cd8b 100644 --- a/client/services/file.ts +++ b/client/services/file.ts @@ -118,19 +118,18 @@ export const useFile = () => { export const useFileByGroup = (groupId: number, fileName: string) => { const { data: file } = useQuery({ queryFn: () => getFile({ groupId, fileName }), - queryKey: ['getFile'] + queryKey: ['getFile', groupId, fileName] }); return { file }; }; export const useAllFileByGroup = (groupId: number) => { - const queryResult = useQuery({ + const { data, refetch, isFetching } = useQuery({ queryFn: () => getAllFile(groupId), - queryKey: ['getAllFile'] + queryKey: ['getAllFile', groupID] }); - const { data, refetch, isFetching } = queryResult; - return { data, refetch, isFetching }; + return { groupFiles, refetchGroupFiles, isFetching }; };