mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
fix lint warnings
This commit is contained in:
parent
047f5b364f
commit
9c83347162
@ -81,10 +81,10 @@ console.log(state.mfaError);
|
||||
<div className="description">{state.strings.mfaEnter}</div>
|
||||
<Input.OTP onChange={actions.setCode} />
|
||||
<div className="alert">
|
||||
{ state.mfaError == 'Error: 403' && (
|
||||
{ state.mfaError === '403' && (
|
||||
<span>{state.strings.mfaError}</span>
|
||||
)}
|
||||
{ state.mfaError == 'Error: 429' && (
|
||||
{ state.mfaError === '429' && (
|
||||
<span>{state.strings.mfaDisabled}</span>
|
||||
)}
|
||||
</div>
|
||||
|
@ -52,8 +52,9 @@ export function useLogin() {
|
||||
await app.actions.login(state.username, state.password, state.mfaCode)
|
||||
}
|
||||
catch (err) {
|
||||
if (err == 'Error: 405' || err == 'Error: 403' || err == 'Error: 429') {
|
||||
updateState({ busy: false, mfaModal: true, mfaError: err.toString() });
|
||||
const msg = err?.message;
|
||||
if (msg === '405' || msg === '403' || msg === '429') {
|
||||
updateState({ busy: false, mfaModal: true, mfaError: msg });
|
||||
}
|
||||
else {
|
||||
console.log(err);
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { AccountAccessWrapper, LoginModal, MFAModal, SealModal, LogoutContent } from './AccountAccess.styled';
|
||||
import { useAccountAccess } from './useAccountAccess.hook';
|
||||
import { Button, Modal, Switch, Input, Radio, Select, Flex, Typography } from 'antd';
|
||||
import type { GetProp } from 'antd';
|
||||
import type { OTPProps } from 'antd/es/input/OTP';
|
||||
import { LogoutOutlined, SettingOutlined, UserOutlined, LockOutlined, ExclamationCircleOutlined, KeyOutlined } from '@ant-design/icons';
|
||||
import { Button, Modal, Switch, Input, Radio, Select } from 'antd';
|
||||
import { LogoutOutlined, SettingOutlined, UserOutlined, LockOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { CopyButton } from '../../../../copyButton/CopyButton';
|
||||
import { useRef } from 'react';
|
||||
|
||||
@ -110,7 +108,7 @@ export function AccountAccess() {
|
||||
<div className="control">
|
||||
<Switch size="small" checked={state.mfaEnabled} onChange={enable => enableMFA(enable)} />
|
||||
</div>
|
||||
<div className="switchLabel">Multi-Factor Authentication</div>
|
||||
<div className="switchLabel">{state.strings.mfaTitle}</div>
|
||||
</div>
|
||||
<div className="link" onClick={actions.setEditSeal}>
|
||||
<div className="control">
|
||||
@ -277,10 +275,10 @@ export function AccountAccess() {
|
||||
</div>
|
||||
<Input.OTP onChange={actions.setCode} />
|
||||
<div className="alert">
|
||||
{ state.mfaError && state.mfaErrorCode == 'Error: 401' && (
|
||||
{ state.mfaError && state.mfaErrorCode === '401' && (
|
||||
<span>{state.strings.mfaError}</span>
|
||||
)}
|
||||
{ state.mfaError && state.mfaErrorCode == 'Error: 429' && (
|
||||
{ state.mfaError && state.mfaErrorCode === '429' && (
|
||||
<span>{state.strings.mfaDisabled}</span>
|
||||
)}
|
||||
</div>
|
||||
|
@ -354,8 +354,8 @@ export function useAccountAccess() {
|
||||
updateState({ busy: false, mfaModal: false });
|
||||
}
|
||||
catch (err) {
|
||||
console.log("error code: ", err);
|
||||
updateState({ busy: false, mfaError: true, mfaErrorCode: err });
|
||||
const msg = err?.message;
|
||||
updateState({ busy: false, mfaError: true, mfaErrorCode: msg });
|
||||
throw new Error('failed to confirm mfa');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user