Skip to content

Commit

Permalink
fix: add enabled flag for useProfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
naumovski-filip committed Sep 11, 2023
1 parent 4d85c1c commit 2b6cc37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hooks/useProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const useDeleteProfile = (options?: UseMutationOptions<ServiceResponse<Co
export const useProfiles = (
options?: UseQueryOptions<ServiceResponse<ListProfilesResponse> | undefined, unknown, ServiceResponse<ListProfilesResponse> | undefined, string[]>,
) => {
const query = useQuery(['listProfiles'], listProfiles, { ...options });
const user = useAccountStore((s) => s.user);
const query = useQuery(['listProfiles'], listProfiles, { ...options, enabled: !!user });
const { canManageProfiles } = useAccountStore();
if (!canManageProfiles && query.data?.responseData.canManageProfiles) {
useAccountStore.setState({ canManageProfiles: true });
Expand Down

0 comments on commit 2b6cc37

Please sign in to comment.