mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Change prettier rules
This commit is contained in:
@@ -5,41 +5,36 @@ import { PanelBodyHeader } from 'app/components/ui/Panel';
|
||||
import { ValidationError } from 'app/components/ui/form/FormModel';
|
||||
|
||||
interface Props {
|
||||
error: ValidationError;
|
||||
onClose?: () => void;
|
||||
error: ValidationError;
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
let autoHideTimer: number | null = null;
|
||||
function resetTimeout(): void {
|
||||
if (autoHideTimer) {
|
||||
clearTimeout(autoHideTimer);
|
||||
autoHideTimer = null;
|
||||
}
|
||||
if (autoHideTimer) {
|
||||
clearTimeout(autoHideTimer);
|
||||
autoHideTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
const AuthError: ComponentType<Props> = ({ error, onClose }) => {
|
||||
useEffect(() => {
|
||||
resetTimeout();
|
||||
useEffect(() => {
|
||||
resetTimeout();
|
||||
|
||||
if (
|
||||
onClose &&
|
||||
typeof error !== 'string' &&
|
||||
error.payload &&
|
||||
error.payload.canRepeatIn
|
||||
) {
|
||||
const msLeft = error.payload.canRepeatIn * 1000;
|
||||
// 1500 to let the user see, that time is elapsed
|
||||
setTimeout(onClose, msLeft - Date.now() + 1500);
|
||||
}
|
||||
if (onClose && typeof error !== 'string' && error.payload && error.payload.canRepeatIn) {
|
||||
const msLeft = error.payload.canRepeatIn * 1000;
|
||||
// 1500 to let the user see, that time is elapsed
|
||||
setTimeout(onClose, msLeft - Date.now() + 1500);
|
||||
}
|
||||
|
||||
return resetTimeout;
|
||||
}, [error, onClose]);
|
||||
return resetTimeout;
|
||||
}, [error, onClose]);
|
||||
|
||||
return (
|
||||
<PanelBodyHeader type="error" onClose={onClose}>
|
||||
{resolveError(error)}
|
||||
</PanelBodyHeader>
|
||||
);
|
||||
return (
|
||||
<PanelBodyHeader type="error" onClose={onClose}>
|
||||
{resolveError(error)}
|
||||
</PanelBodyHeader>
|
||||
);
|
||||
};
|
||||
|
||||
export default AuthError;
|
||||
|
||||
Reference in New Issue
Block a user