const [openDetails, setOpenDetails] = useState(false);
const [messages, setMessages] = useState<string[]>([]);
const [alertVariant, setAlertVariant] = useState<AlertVariant>('loading');
- const { data, isFetching, refetch } = useCheckGitHubConfigQuery();
+ const { data, isFetching, refetch } = useCheckGitHubConfigQuery(true);
const modalHeader = translate(`${intlPrefix}.details.title`);
const applicationField = isAutoProvisioning ? 'autoProvisioning' : 'jit';
Feature.GithubProvisioning
);
const { data: githubProvisioningStatus } = useGithubStatusQuery();
- const { refetch } = useCheckGitHubConfigQuery();
const toggleGithubProvisioning = useToggleGithubProvisioningMutation();
const [newGithubProvisioningStatus, setNewGithubProvisioningStatus] = useState<boolean>();
const hasGithubProvisioningConfigChange =
};
const enabled = values[GITHUB_ENABLED_FIELD]?.value === 'true';
+ const { refetch } = useCheckGitHubConfigQuery(enabled);
const appId = values[GITHUB_APP_ID_FIELD]?.value as string;
const url = values[GITHUB_API_URL_FIELD]?.value;
const clientIdIsNotSet = values[GITHUB_CLIENT_ID_FIELD]?.isNotSet;
});
}
-export const useCheckGitHubConfigQuery = () => {
- return useQuery(['identity_provider', 'github_check'], checkConfigurationValidity);
+export const useCheckGitHubConfigQuery = (githubEnabled: boolean) => {
+ return useQuery(['identity_provider', 'github_check'], checkConfigurationValidity, {
+ enabled: githubEnabled,
+ });
};