Created
July 6, 2022 15:49
-
-
Save shawn-sandy/813d2100f95f7065b2b87f02bd829add to your computer and use it in GitHub Desktop.
Install progress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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