AuthorizeRejectButtons: skip animations if countdown is undefined

environments/review-pending-ti-nmethu/deployments/2982
Alex Gleason 2 years ago
parent 09ed0bccab
commit f216b52b36
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -26,15 +26,20 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
}
setState('pending');
} else {
setState(present);
timeout.current = setTimeout(async () => {
const doAction = async () => {
try {
await action();
setState(past);
} catch (e) {
console.error(e);
}
}, countdown);
};
if (typeof countdown === 'number') {
setState(present);
timeout.current = setTimeout(doAction, countdown);
} else {
doAction();
}
}
}

Loading…
Cancel
Save