added loaded and enable disable for useQuery
This commit is contained in:
+6
-3
@@ -16,7 +16,7 @@ import { useSelector } from "react-redux";
|
||||
import { useAppSelector } from "./store";
|
||||
import { useUtils } from "./utils";
|
||||
|
||||
export const useFiles = () => {
|
||||
export const useFiles = (enabled = true) => {
|
||||
const params = useParams();
|
||||
// TODO: Remove any
|
||||
const sortBy = useSelector((state: any) => state.filter.sortBy);
|
||||
@@ -42,6 +42,7 @@ export const useFiles = () => {
|
||||
startAtName: lastElement.filename,
|
||||
};
|
||||
},
|
||||
enabled,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -77,8 +78,10 @@ export const useFilesClient = () => {
|
||||
return { ...filesReactClientQuery, invalidateFilesCache };
|
||||
};
|
||||
|
||||
export const useQuickFiles = () => {
|
||||
const quickFilesQuery = useQuery("quickFiles", getQuickFilesListAPI);
|
||||
export const useQuickFiles = (enabled = true) => {
|
||||
const quickFilesQuery = useQuery("quickFiles", getQuickFilesListAPI, {
|
||||
enabled,
|
||||
});
|
||||
|
||||
return { ...quickFilesQuery };
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getFolderInfoAPI, getFoldersListAPI } from "../api/foldersAPI";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useUtils } from "./utils";
|
||||
|
||||
export const useFolders = () => {
|
||||
export const useFolders = (enabled = true) => {
|
||||
const params = useParams();
|
||||
const sortBy = useSelector((state: any) => state.filter.sortBy);
|
||||
const { isTrash } = useUtils();
|
||||
@@ -19,7 +19,8 @@ export const useFolders = () => {
|
||||
trashMode: isTrash,
|
||||
},
|
||||
],
|
||||
getFoldersListAPI
|
||||
getFoldersListAPI,
|
||||
{ enabled }
|
||||
);
|
||||
|
||||
return { ...foldersReactQuery };
|
||||
|
||||
Reference in New Issue
Block a user