Skip to content

Commit

Permalink
fix: adds useAuthorize dependancy for get_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
shaheer-deriv committed Feb 13, 2024
1 parent 9a02b06 commit b4f9917
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api/src/hooks/useSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useMemo } from 'react';
import useAuthorize from './useAuthorize';
import useQuery from '../useQuery';
import useInvalidateQuery from '../useInvalidateQuery';
import useMutation from '../useMutation';
Expand All @@ -9,7 +10,8 @@ type TSetSettingsPayload = NonNullable<

/** A custom hook to get and update the user settings. */
const useSettings = () => {
const { data, ...rest } = useQuery('get_settings');
const { isSuccess } = useAuthorize();
const { data, ...rest } = useQuery('get_settings', { options: { enabled: isSuccess } });
const { mutate, ...mutate_rest } = useMutation('set_settings', { onSuccess: () => invalidate('get_settings') });
const invalidate = useInvalidateQuery();

Expand Down

0 comments on commit b4f9917

Please sign in to comment.