Update slack query request logic

This commit is contained in:
Nate Kelley 2025-07-10 09:54:14 -06:00
parent f8a2e86297
commit cefdfe6fdf
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 3 additions and 5 deletions

View File

@ -21,10 +21,11 @@ export const useGetSlackIntegration = (enabled = true) => {
// GET /api/v2/slack/channels
export const useGetSlackChannels = (enabled = true) => {
const { data: slackIntegration } = useGetSlackIntegration();
return useQuery({
...slackQueryKeys.slackGetChannels,
queryFn: getSlackChannels,
enabled
enabled: enabled && slackIntegration?.connected
});
};
@ -100,10 +101,7 @@ export const useRemoveSlackIntegration = () => {
queryKey: slackQueryKeys.slackGetIntegration.queryKey,
refetchType: 'all'
});
queryClient.invalidateQueries({
queryKey: slackQueryKeys.slackGetChannels.queryKey,
refetchType: 'all'
});
queryClient.setQueryData(slackQueryKeys.slackGetChannels.queryKey, { channels: [] });
}
});
};