| 53 | type ConfigureSSOParams = Record<string, unknown> |
| 54 | |
| 55 | export function useConfigureSSO() { |
| 56 | const queryClient = useQueryClient() |
| 57 | |
| 58 | return useMutation({ |
| 59 | mutationFn: (config: ConfigureSSOParams) => |
| 60 | requestJson(ssoRegistrationContract, { |
| 61 | body: config as SsoRegistrationBody, |
| 62 | }), |
| 63 | onSettled: (_data, _error, variables) => { |
| 64 | queryClient.invalidateQueries({ queryKey: ssoKeys.providers() }) |
| 65 | |
| 66 | const orgId = typeof variables.orgId === 'string' ? variables.orgId : undefined |
| 67 | if (orgId) { |
| 68 | queryClient.invalidateQueries({ queryKey: organizationKeys.detail(orgId) }) |
| 69 | queryClient.invalidateQueries({ queryKey: organizationKeys.lists() }) |
| 70 | } |
| 71 | }, |
| 72 | }) |
| 73 | } |