Skip to content

Commit 20ed06b

Browse files
Georgi2704Georgi2704
andauthored
Small change to useQueryWithFetch for the default sending level (#833)
Co-authored-by: Georgi2704 <[email protected]>
1 parent 2abb8ce commit 20ed06b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/orchestrator-ui-components/src/hooks/useQueryWithFetch.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useQuery } from 'react-query';
1+
import { UseQueryOptions, useQuery } from 'react-query';
22

33
import { Variables } from 'graphql-request/build/cjs/types';
44
import { signOut } from 'next-auth/react';
@@ -9,6 +9,7 @@ export const useQueryWithFetch = <T, V extends Variables>(
99
url: string,
1010
queryVars: V,
1111
queryKey: string,
12+
options?: UseQueryOptions<T, unknown, T, [string, ...unknown[]]>,
1213
) => {
1314
const { session } = useWfoSession();
1415
const requestHeaders = {
@@ -29,5 +30,9 @@ export const useQueryWithFetch = <T, V extends Variables>(
2930
}
3031
return (await response.json()) as T;
3132
};
32-
return useQuery([queryKey, ...Object.values(queryVars)], fetchData);
33+
return useQuery(
34+
[queryKey, ...Object.values(queryVars)],
35+
fetchData,
36+
options,
37+
);
3338
};

0 commit comments

Comments
 (0)