AuthorizeRejectButtons: skip animations if countdown is undefined
This commit is contained in:
parent
09ed0bccab
commit
f216b52b36
1 changed files with 8 additions and 3 deletions
|
@ -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…
Reference in a new issue