Skip to main content

Function: confirmationStateOf

confirmationStateOf(error): ConfirmationState | undefined

The ConfirmationState of a failure, or undefined when it is not a failed confirmation. Accepts an SDK error or a plain-object view of one (an app's wrapper with a code), and decides from the code alone, so a screen never matches 'CONFIRMATION_ABORTED' itself.

Parameters​

ParameterType
errorunknown

Returns​

ConfirmationState | undefined

Example​

switch (confirmationStateOf(error)) {
case 'aborted': return; // the person closed the dialog
case 'timeout': return showStillPending(error.uniqueKey);
case 'failed': return showCouldNotCheck(error.uniqueKey);
case undefined: return showFailure(error);
}