Skip to content

Instantly share code, notes, and snippets.

@shawn-sandy
Created July 6, 2022 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawn-sandy/813d2100f95f7065b2b87f02bd829add to your computer and use it in GitHub Desktop.
Save shawn-sandy/813d2100f95f7065b2b87f02bd829add to your computer and use it in GitHub Desktop.
Install progress
// NOTE: this definitely is not working correctly, but is relatively close to what needs to be done
useEffect(() => {
if (existingIntegration) {
return;
}
if (atsLinkStatus === ExternalAtsLinkStatusKind.InvalidCredentials) {
onApiFailure();
} else {
// @ts-ignore
if (!!atsLinkStatus && !inPendingState({ status: { kind: atsLinkStatus } })) {
next();
}
}
}, [existingIntegration, atsLinkStatus]);
const install = (): void => {
setError(false);
setModalButtons(undefined);
if (!!linkId) {
updateAtsLink(linkId, config).then(() => {
next();
}, onFailure);
} else {
createAtsLink(atsType, config).then((resp) => {
if (!!setIntegrationId) {
setIntegrationId(resp?.data?.createExternalAtsLink?.link?.id);
}
// NOTE: we can't call next here, we need to start inspecting the atsLinkStatus
// next();
}, onFailure);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment