Convert 'error' usage to Toast
This commit is contained in:
@@ -3,7 +3,6 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { disableMfa } from 'soapbox/actions/mfa';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { Button, Form, FormGroup, Input, FormActions, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
import toast from 'soapbox/toast';
|
||||
@@ -31,7 +30,7 @@ const DisableOtpForm: React.FC = () => {
|
||||
}).finally(() => {
|
||||
setIsLoading(false);
|
||||
}).catch(() => {
|
||||
dispatch(snackbar.error(intl.formatMessage(messages.disableFail)));
|
||||
toast.error(intl.formatMessage(messages.disableFail));
|
||||
});
|
||||
}, [password, dispatch, intl]);
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { fetchBackupCodes } from 'soapbox/actions/mfa';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { Button, FormActions, Spinner, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
import toast from 'soapbox/toast';
|
||||
|
||||
const messages = defineMessages({
|
||||
mfaCancelButton: { id: 'column.mfa_cancel', defaultMessage: 'Cancel' },
|
||||
@@ -30,7 +30,7 @@ const EnableOtpForm: React.FC<IEnableOtpForm> = ({ displayOtpForm, handleSetupPr
|
||||
setBackupCodes(backupCodes);
|
||||
})
|
||||
.catch(() => {
|
||||
dispatch(snackbar.error(intl.formatMessage(messages.codesFail)));
|
||||
toast.error(intl.formatMessage(messages.codesFail));
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
setupMfa,
|
||||
confirmMfa,
|
||||
} from 'soapbox/actions/mfa';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { Button, Form, FormActions, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
import toast from 'soapbox/toast';
|
||||
@@ -39,7 +38,7 @@ const OtpConfirmForm: React.FC = () => {
|
||||
dispatch(setupMfa('totp')).then((data: any) => {
|
||||
setState((prevState) => ({ ...prevState, qrCodeURI: data.provisioning_uri, confirmKey: data.key }));
|
||||
}).catch(() => {
|
||||
dispatch(snackbar.error(intl.formatMessage(messages.qrFail)));
|
||||
toast.error(intl.formatMessage(messages.qrFail));
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -56,7 +55,7 @@ const OtpConfirmForm: React.FC = () => {
|
||||
toast.success(intl.formatMessage(messages.mfaConfirmSuccess));
|
||||
history.push('../auth/edit');
|
||||
}).catch(() => {
|
||||
dispatch(snackbar.error(intl.formatMessage(messages.confirmFail)));
|
||||
toast.error(intl.formatMessage(messages.confirmFail));
|
||||
setState((prevState) => ({ ...prevState, isLoading: false }));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user