sforkowany z mirror/soapbox
Convert 'error' usage to Toast
rodzic
b7d0b4abe8
commit
b348ca71b9
|
@ -14,7 +14,6 @@ import { createApp } from 'soapbox/actions/apps';
|
||||||
import { fetchMeSuccess, fetchMeFail } from 'soapbox/actions/me';
|
import { fetchMeSuccess, fetchMeFail } from 'soapbox/actions/me';
|
||||||
import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth';
|
import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth';
|
||||||
import { startOnboarding } from 'soapbox/actions/onboarding';
|
import { startOnboarding } from 'soapbox/actions/onboarding';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { custom } from 'soapbox/custom';
|
import { custom } from 'soapbox/custom';
|
||||||
import { queryClient } from 'soapbox/queries/client';
|
import { queryClient } from 'soapbox/queries/client';
|
||||||
import KVStore from 'soapbox/storage/kv-store';
|
import KVStore from 'soapbox/storage/kv-store';
|
||||||
|
@ -217,7 +216,7 @@ export const logIn = (username: string, password: string) =>
|
||||||
throw error;
|
throw error;
|
||||||
} else {
|
} else {
|
||||||
// Return "wrong password" message.
|
// Return "wrong password" message.
|
||||||
dispatch(snackbar.error(messages.invalidCredentials));
|
toast.error(messages.invalidCredentials);
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { List as ImmutableList } from 'immutable';
|
||||||
import throttle from 'lodash/throttle';
|
import throttle from 'lodash/throttle';
|
||||||
import { defineMessages, IntlShape } from 'react-intl';
|
import { defineMessages, IntlShape } from 'react-intl';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import api from 'soapbox/api';
|
import api from 'soapbox/api';
|
||||||
import { search as emojiSearch } from 'soapbox/features/emoji/emoji-mart-search-light';
|
import { search as emojiSearch } from 'soapbox/features/emoji/emoji-mart-search-light';
|
||||||
import { tagHistory } from 'soapbox/settings';
|
import { tagHistory } from 'soapbox/settings';
|
||||||
|
@ -249,7 +248,7 @@ const submitCompose = (composeId: string, routerHistory?: History, force = false
|
||||||
let to = compose.to;
|
let to = compose.to;
|
||||||
|
|
||||||
if (!validateSchedule(state, composeId)) {
|
if (!validateSchedule(state, composeId)) {
|
||||||
dispatch(snackbar.error(messages.scheduleError));
|
toast.error(messages.scheduleError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,18 +349,18 @@ const uploadCompose = (composeId: string, files: FileList, intl: IntlShape) =>
|
||||||
if (isImage && maxImageSize && (f.size > maxImageSize)) {
|
if (isImage && maxImageSize && (f.size > maxImageSize)) {
|
||||||
const limit = formatBytes(maxImageSize);
|
const limit = formatBytes(maxImageSize);
|
||||||
const message = intl.formatMessage(messages.exceededImageSizeLimit, { limit });
|
const message = intl.formatMessage(messages.exceededImageSizeLimit, { limit });
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
dispatch(uploadComposeFail(composeId, true));
|
dispatch(uploadComposeFail(composeId, true));
|
||||||
return;
|
return;
|
||||||
} else if (isVideo && maxVideoSize && (f.size > maxVideoSize)) {
|
} else if (isVideo && maxVideoSize && (f.size > maxVideoSize)) {
|
||||||
const limit = formatBytes(maxVideoSize);
|
const limit = formatBytes(maxVideoSize);
|
||||||
const message = intl.formatMessage(messages.exceededVideoSizeLimit, { limit });
|
const message = intl.formatMessage(messages.exceededVideoSizeLimit, { limit });
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
dispatch(uploadComposeFail(composeId, true));
|
dispatch(uploadComposeFail(composeId, true));
|
||||||
return;
|
return;
|
||||||
} else if (isVideo && maxVideoDuration && (videoDurationInSeconds > maxVideoDuration)) {
|
} else if (isVideo && maxVideoDuration && (videoDurationInSeconds > maxVideoDuration)) {
|
||||||
const message = intl.formatMessage(messages.exceededVideoDurationLimit, { limit: maxVideoDuration });
|
const message = intl.formatMessage(messages.exceededVideoDurationLimit, { limit: maxVideoDuration });
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
dispatch(uploadComposeFail(composeId, true));
|
dispatch(uploadComposeFail(composeId, true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import resizeImage from 'soapbox/utils/resize-image';
|
||||||
import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer';
|
import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer';
|
||||||
import { fetchMedia, uploadMedia } from './media';
|
import { fetchMedia, uploadMedia } from './media';
|
||||||
import { closeModal, openModal } from './modals';
|
import { closeModal, openModal } from './modals';
|
||||||
import snackbar from './snackbar';
|
|
||||||
import {
|
import {
|
||||||
STATUS_FETCH_SOURCE_FAIL,
|
STATUS_FETCH_SOURCE_FAIL,
|
||||||
STATUS_FETCH_SOURCE_REQUEST,
|
STATUS_FETCH_SOURCE_REQUEST,
|
||||||
|
@ -164,7 +163,7 @@ const uploadEventBanner = (file: File, intl: IntlShape) =>
|
||||||
if (maxImageSize && (file.size > maxImageSize)) {
|
if (maxImageSize && (file.size > maxImageSize)) {
|
||||||
const limit = formatBytes(maxImageSize);
|
const limit = formatBytes(maxImageSize);
|
||||||
const message = intl.formatMessage(messages.exceededImageSizeLimit, { limit });
|
const message = intl.formatMessage(messages.exceededImageSizeLimit, { limit });
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
dispatch(uploadEventBannerFail(true));
|
dispatch(uploadEventBannerFail(true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import { initMuteModal } from 'soapbox/actions/mutes';
|
||||||
import { initReport } from 'soapbox/actions/reports';
|
import { initReport } from 'soapbox/actions/reports';
|
||||||
import { setSearchAccount } from 'soapbox/actions/search';
|
import { setSearchAccount } from 'soapbox/actions/search';
|
||||||
import { getSettings } from 'soapbox/actions/settings';
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import Badge from 'soapbox/components/badge';
|
import Badge from 'soapbox/components/badge';
|
||||||
import StillImage from 'soapbox/components/still-image';
|
import StillImage from 'soapbox/components/still-image';
|
||||||
import { Avatar, HStack, IconButton, Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui';
|
import { Avatar, HStack, IconButton, Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui';
|
||||||
|
@ -93,7 +92,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
}, {
|
}, {
|
||||||
onError: (error: AxiosError) => {
|
onError: (error: AxiosError) => {
|
||||||
const data = error.response?.data as any;
|
const data = error.response?.data as any;
|
||||||
dispatch(snackbar.error(data?.error));
|
toast.error(data?.error);
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
history.push(`/chats/${response.data.id}`);
|
history.push(`/chats/${response.data.id}`);
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { AxiosError } from 'axios';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Icon, Input, Stack } from 'soapbox/components/ui';
|
import { Icon, Input, Stack } from 'soapbox/components/ui';
|
||||||
import { ChatWidgetScreens, useChatContext } from 'soapbox/contexts/chat-context';
|
import { ChatWidgetScreens, useChatContext } from 'soapbox/contexts/chat-context';
|
||||||
import { useAppDispatch, useDebounce } from 'soapbox/hooks';
|
import { useDebounce } from 'soapbox/hooks';
|
||||||
import { useChats } from 'soapbox/queries/chats';
|
import { useChats } from 'soapbox/queries/chats';
|
||||||
import { queryClient } from 'soapbox/queries/client';
|
import { queryClient } from 'soapbox/queries/client';
|
||||||
import useAccountSearch from 'soapbox/queries/search';
|
import useAccountSearch from 'soapbox/queries/search';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
import { ChatKeys } from '../../../../queries/chats';
|
import { ChatKeys } from '../../../../queries/chats';
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ const ChatSearch = (props: IChatSearch) => {
|
||||||
const { isMainPage = false } = props;
|
const { isMainPage = false } = props;
|
||||||
|
|
||||||
const debounce = useDebounce;
|
const debounce = useDebounce;
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
const { changeScreen } = useChatContext();
|
const { changeScreen } = useChatContext();
|
||||||
|
@ -45,7 +44,7 @@ const ChatSearch = (props: IChatSearch) => {
|
||||||
}, {
|
}, {
|
||||||
onError: (error: AxiosError) => {
|
onError: (error: AxiosError) => {
|
||||||
const data = error.response?.data as any;
|
const data = error.response?.data as any;
|
||||||
dispatch(snackbar.error(data?.error));
|
toast.error(data?.error);
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
if (isMainPage) {
|
if (isMainPage) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { deleteAccount } from 'soapbox/actions/security';
|
import { deleteAccount } from 'soapbox/actions/security';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Card, CardBody, CardHeader, CardTitle, Form, FormActions, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
import { Button, Card, CardBody, CardHeader, CardTitle, Form, FormActions, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -40,7 +39,7 @@ const DeleteAccount = () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setPassword('');
|
setPassword('');
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.deleteAccountFail)));
|
toast.error(intl.formatMessage(messages.deleteAccountFail));
|
||||||
});
|
});
|
||||||
}, [password, dispatch, intl]);
|
}, [password, dispatch, intl]);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { changeSettingImmediate } from 'soapbox/actions/settings';
|
import { changeSettingImmediate } from 'soapbox/actions/settings';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Column, Button, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
import { Column, Button, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ const DevelopersChallenge = () => {
|
||||||
dispatch(changeSettingImmediate(['isDeveloper'], true));
|
dispatch(changeSettingImmediate(['isDeveloper'], true));
|
||||||
toast.success(intl.formatMessage(messages.success));
|
toast.success(intl.formatMessage(messages.success));
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.fail)));
|
toast.error(intl.formatMessage(messages.fail));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { changeEmail } from 'soapbox/actions/security';
|
import { changeEmail } from 'soapbox/actions/security';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Card, CardBody, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui';
|
import { Button, Card, CardBody, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -44,7 +43,7 @@ const EditEmail = () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setState((prevState) => ({ ...prevState, password: '' }));
|
setState((prevState) => ({ ...prevState, password: '' }));
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.updateEmailFail)));
|
toast.error(intl.formatMessage(messages.updateEmailFail));
|
||||||
});
|
});
|
||||||
}, [email, password, dispatch, intl]);
|
}, [email, password, dispatch, intl]);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { changePassword } from 'soapbox/actions/security';
|
import { changePassword } from 'soapbox/actions/security';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Card, CardBody, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui';
|
import { Button, Card, CardBody, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -51,7 +50,7 @@ const EditPassword = () => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
resetState();
|
resetState();
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.updatePasswordFail)));
|
toast.error(intl.formatMessage(messages.updatePasswordFail));
|
||||||
});
|
});
|
||||||
}, [currentPassword, newPassword, newPasswordConfirmation, dispatch, intl]);
|
}, [currentPassword, newPassword, newPasswordConfirmation, dispatch, intl]);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { updateNotificationSettings } from 'soapbox/actions/accounts';
|
import { updateNotificationSettings } from 'soapbox/actions/accounts';
|
||||||
import { patchMe } from 'soapbox/actions/me';
|
import { patchMe } from 'soapbox/actions/me';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import BirthdayInput from 'soapbox/components/birthday-input';
|
import BirthdayInput from 'soapbox/components/birthday-input';
|
||||||
import List, { ListItem } from 'soapbox/components/list';
|
import List, { ListItem } from 'soapbox/components/list';
|
||||||
import {
|
import {
|
||||||
|
@ -221,7 +220,7 @@ const EditProfile: React.FC = () => {
|
||||||
toast.success(intl.formatMessage(messages.success));
|
toast.success(intl.formatMessage(messages.success));
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.error)));
|
toast.error(intl.formatMessage(messages.error));
|
||||||
});
|
});
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
import { confirmChangedEmail } from 'soapbox/actions/security';
|
import { confirmChangedEmail } from 'soapbox/actions/security';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Spinner } from 'soapbox/components/ui';
|
import { Spinner } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -41,14 +40,12 @@ const EmailConfirmation = () => {
|
||||||
if (error.response.data.error) {
|
if (error.response.data.error) {
|
||||||
const message = buildErrorMessage(error.response.data.error);
|
const message = buildErrorMessage(error.response.data.error);
|
||||||
|
|
||||||
dispatch(
|
toast.error(
|
||||||
snackbar.error(
|
message,
|
||||||
message,
|
// intl.formatMessage({
|
||||||
// intl.formatMessage({
|
// id: 'email_confirmation.fail',
|
||||||
// id: 'email_confirmation.fail',
|
// defaultMessage,
|
||||||
// defaultMessage,
|
// }),
|
||||||
// }),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,9 +2,9 @@ import React, { useState, useEffect } from 'react';
|
||||||
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
|
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { externalLogin, loginWithCode } from 'soapbox/actions/external-auth';
|
import { externalLogin, loginWithCode } from 'soapbox/actions/external-auth';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Form, FormActions, FormGroup, Input, Spinner } from 'soapbox/components/ui';
|
import { Button, Form, FormActions, FormGroup, Input, Spinner } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ const ExternalLoginForm: React.FC = () => {
|
||||||
const status = error.response?.status;
|
const status = error.response?.status;
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.instanceFailed)));
|
toast.error(intl.formatMessage(messages.instanceFailed));
|
||||||
} else if (!status && error.code === 'ERR_NETWORK') {
|
} else if (!status && error.code === 'ERR_NETWORK') {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.networkFailed)));
|
toast.error(intl.formatMessage(messages.networkFailed));
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { fetchFilters, createFilter, deleteFilter } from 'soapbox/actions/filters';
|
import { fetchFilters, createFilter, deleteFilter } from 'soapbox/actions/filters';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
import ScrollableList from 'soapbox/components/scrollable-list';
|
import ScrollableList from 'soapbox/components/scrollable-list';
|
||||||
import { Button, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
import { Button, CardHeader, CardTitle, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
||||||
|
@ -11,6 +10,7 @@ import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
} from 'soapbox/features/forms';
|
} from 'soapbox/features/forms';
|
||||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
heading: { id: 'column.filters', defaultMessage: 'Muted words' },
|
heading: { id: 'column.filters', defaultMessage: 'Muted words' },
|
||||||
|
@ -81,7 +81,7 @@ const Filters = () => {
|
||||||
dispatch(createFilter(phrase, expiresAt, context, wholeWord, irreversible)).then(() => {
|
dispatch(createFilter(phrase, expiresAt, context, wholeWord, irreversible)).then(() => {
|
||||||
return dispatch(fetchFilters());
|
return dispatch(fetchFilters());
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.create_error)));
|
toast.error(intl.formatMessage(messages.create_error));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ const Filters = () => {
|
||||||
dispatch(deleteFilter(e.currentTarget.dataset.value!)).then(() => {
|
dispatch(deleteFilter(e.currentTarget.dataset.value!)).then(() => {
|
||||||
return dispatch(fetchFilters());
|
return dispatch(fetchFilters());
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.delete_error)));
|
toast.error(intl.formatMessage(messages.delete_error));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { moveAccount } from 'soapbox/actions/security';
|
import { moveAccount } from 'soapbox/actions/security';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
import { Button, Column, Form, FormActions, FormGroup, Input, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useInstance } from 'soapbox/hooks';
|
import { useAppDispatch, useInstance } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -53,7 +52,7 @@ const Migration = () => {
|
||||||
message = intl.formatMessage(messages.moveAccountFailCooldownPeriod);
|
message = intl.formatMessage(messages.moveAccountFailCooldownPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { defineMessages, FormattedMessage } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { patchMe } from 'soapbox/actions/me';
|
import { patchMe } from 'soapbox/actions/me';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useOwnAccount } from 'soapbox/hooks';
|
import { useOwnAccount } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
import { isDefaultAvatar } from 'soapbox/utils/accounts';
|
import { isDefaultAvatar } from 'soapbox/utils/accounts';
|
||||||
import resizeImage from 'soapbox/utils/resize-image';
|
import resizeImage from 'soapbox/utils/resize-image';
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => {
|
||||||
setSelectedFile(null);
|
setSelectedFile(null);
|
||||||
|
|
||||||
if (error.response?.status === 422) {
|
if (error.response?.status === 422) {
|
||||||
dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', '')));
|
toast.error((error.response.data as any).error.replace('Validation failed: ', ''));
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error(messages.error));
|
toast.error(messages.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { patchMe } from 'soapbox/actions/me';
|
import { patchMe } from 'soapbox/actions/me';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Card, CardBody, FormGroup, Stack, Text, Textarea } from 'soapbox/components/ui';
|
import { Button, Card, CardBody, FormGroup, Stack, Text, Textarea } from 'soapbox/components/ui';
|
||||||
import { useOwnAccount } from 'soapbox/hooks';
|
import { useOwnAccount } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ const BioStep = ({ onNext }: { onNext: () => void }) => {
|
||||||
if (error.response?.status === 422) {
|
if (error.response?.status === 422) {
|
||||||
setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
|
setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error(messages.error));
|
toast.error(messages.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { patchMe } from 'soapbox/actions/me';
|
import { patchMe } from 'soapbox/actions/me';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import StillImage from 'soapbox/components/still-image';
|
import StillImage from 'soapbox/components/still-image';
|
||||||
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useOwnAccount } from 'soapbox/hooks';
|
import { useOwnAccount } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
import { isDefaultHeader } from 'soapbox/utils/accounts';
|
import { isDefaultHeader } from 'soapbox/utils/accounts';
|
||||||
import resizeImage from 'soapbox/utils/resize-image';
|
import resizeImage from 'soapbox/utils/resize-image';
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => {
|
||||||
setSelectedFile(null);
|
setSelectedFile(null);
|
||||||
|
|
||||||
if (error.response?.status === 422) {
|
if (error.response?.status === 422) {
|
||||||
dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', '')));
|
toast.error((error.response.data as any).error.replace('Validation failed: ', ''));
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error(messages.error));
|
toast.error(messages.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { patchMe } from 'soapbox/actions/me';
|
import { patchMe } from 'soapbox/actions/me';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Card, CardBody, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
import { Button, Card, CardBody, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useOwnAccount } from 'soapbox/hooks';
|
import { useOwnAccount } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ const DisplayNameStep = ({ onNext }: { onNext: () => void }) => {
|
||||||
if (error.response?.status === 422) {
|
if (error.response?.status === 422) {
|
||||||
setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
|
setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]);
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error(messages.error));
|
toast.error(messages.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { disableMfa } from 'soapbox/actions/mfa';
|
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 { Button, Form, FormGroup, Input, FormActions, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -31,7 +30,7 @@ const DisableOtpForm: React.FC = () => {
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.disableFail)));
|
toast.error(intl.formatMessage(messages.disableFail));
|
||||||
});
|
});
|
||||||
}, [password, dispatch, intl]);
|
}, [password, dispatch, intl]);
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { fetchBackupCodes } from 'soapbox/actions/mfa';
|
import { fetchBackupCodes } from 'soapbox/actions/mfa';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, FormActions, Spinner, Stack, Text } from 'soapbox/components/ui';
|
import { Button, FormActions, Spinner, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
mfaCancelButton: { id: 'column.mfa_cancel', defaultMessage: 'Cancel' },
|
mfaCancelButton: { id: 'column.mfa_cancel', defaultMessage: 'Cancel' },
|
||||||
|
@ -30,7 +30,7 @@ const EnableOtpForm: React.FC<IEnableOtpForm> = ({ displayOtpForm, handleSetupPr
|
||||||
setBackupCodes(backupCodes);
|
setBackupCodes(backupCodes);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.codesFail)));
|
toast.error(intl.formatMessage(messages.codesFail));
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
setupMfa,
|
setupMfa,
|
||||||
confirmMfa,
|
confirmMfa,
|
||||||
} from 'soapbox/actions/mfa';
|
} from 'soapbox/actions/mfa';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Form, FormActions, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
import { Button, Form, FormActions, FormGroup, Input, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch } from 'soapbox/hooks';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -39,7 +38,7 @@ const OtpConfirmForm: React.FC = () => {
|
||||||
dispatch(setupMfa('totp')).then((data: any) => {
|
dispatch(setupMfa('totp')).then((data: any) => {
|
||||||
setState((prevState) => ({ ...prevState, qrCodeURI: data.provisioning_uri, confirmKey: data.key }));
|
setState((prevState) => ({ ...prevState, qrCodeURI: data.provisioning_uri, confirmKey: data.key }));
|
||||||
}).catch(() => {
|
}).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));
|
toast.success(intl.formatMessage(messages.mfaConfirmSuccess));
|
||||||
history.push('../auth/edit');
|
history.push('../auth/edit');
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.confirmFail)));
|
toast.error(intl.formatMessage(messages.confirmFail));
|
||||||
setState((prevState) => ({ ...prevState, isLoading: false }));
|
setState((prevState) => ({ ...prevState, isLoading: false }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { remoteInteraction } from 'soapbox/actions/interactions';
|
import { remoteInteraction } from 'soapbox/actions/interactions';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { Button, Modal, Stack, Text } from 'soapbox/components/ui';
|
import { Button, Modal, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppSelector, useAppDispatch, useFeatures, useSoapboxConfig, useInstance } from 'soapbox/hooks';
|
import { useAppSelector, useAppDispatch, useFeatures, useSoapboxConfig, useInstance } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||||
|
@ -55,7 +55,7 @@ const UnauthorizedModal: React.FC<IUnauthorizedModal> = ({ action, onClose, acco
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.message === 'Couldn\'t find user') {
|
if (error.message === 'Couldn\'t find user') {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.userNotFoundError)));
|
toast.error(intl.formatMessage(messages.userNotFoundError));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,6 @@ import OtpInput from 'react-otp-input';
|
||||||
|
|
||||||
import { verifyCredentials } from 'soapbox/actions/auth';
|
import { verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import { closeModal } from 'soapbox/actions/modals';
|
import { closeModal } from 'soapbox/actions/modals';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { reConfirmPhoneVerification, reRequestPhoneVerification } from 'soapbox/actions/verification';
|
import { reConfirmPhoneVerification, reRequestPhoneVerification } from 'soapbox/actions/verification';
|
||||||
import { FormGroup, PhoneInput, Modal, Stack, Text } from 'soapbox/components/ui';
|
import { FormGroup, PhoneInput, Modal, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useAppSelector, useInstance } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useInstance } from 'soapbox/hooks';
|
||||||
|
@ -77,11 +76,7 @@ const VerifySmsModal: React.FC<IVerifySmsModal> = ({ onClose }) => {
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
setStatus(Statuses.IDLE);
|
setStatus(Statuses.IDLE);
|
||||||
dispatch(
|
toast.error(intl.formatMessage(messages.verificationInvalid));
|
||||||
snackbar.error(
|
|
||||||
intl.formatMessage(messages.verificationInvalid),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +87,7 @@ const VerifySmsModal: React.FC<IVerifySmsModal> = ({ onClose }) => {
|
||||||
})
|
})
|
||||||
.finally(() => setStatus(Statuses.REQUESTED))
|
.finally(() => setStatus(Statuses.REQUESTED))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
dispatch(
|
toast.error(intl.formatMessage(messages.verificationFail));
|
||||||
snackbar.error(
|
|
||||||
intl.formatMessage(messages.verificationFail),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,11 +186,7 @@ const VerifySmsModal: React.FC<IVerifySmsModal> = ({ onClose }) => {
|
||||||
.then(() => dispatch(closeModal('VERIFY_SMS')));
|
.then(() => dispatch(closeModal('VERIFY_SMS')));
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(() => dispatch(
|
.catch(() => toast.error(intl.formatMessage(messages.verificationExpired)));
|
||||||
snackbar.error(
|
|
||||||
intl.formatMessage(messages.verificationExpired),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
subscribeAccount,
|
subscribeAccount,
|
||||||
unsubscribeAccount,
|
unsubscribeAccount,
|
||||||
} from 'soapbox/actions/accounts';
|
} from 'soapbox/actions/accounts';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { IconButton } from 'soapbox/components/ui';
|
import { IconButton } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
|
||||||
import toast from 'soapbox/toast';
|
import toast from 'soapbox/toast';
|
||||||
|
@ -44,13 +43,13 @@ const SubscriptionButton = ({ account }: ISubscriptionButton) => {
|
||||||
toast.success(intl.formatMessage(messages.subscribeSuccess));
|
toast.success(intl.formatMessage(messages.subscribeSuccess));
|
||||||
|
|
||||||
const onSubscribeFailure = () =>
|
const onSubscribeFailure = () =>
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.subscribeFailure)));
|
toast.error(intl.formatMessage(messages.subscribeFailure));
|
||||||
|
|
||||||
const onUnsubscribeSuccess = () =>
|
const onUnsubscribeSuccess = () =>
|
||||||
toast.success(intl.formatMessage(messages.unsubscribeSuccess));
|
toast.success(intl.formatMessage(messages.unsubscribeSuccess));
|
||||||
|
|
||||||
const onUnsubscribeFailure = () =>
|
const onUnsubscribeFailure = () =>
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.unsubscribeFailure)));
|
toast.error(intl.formatMessage(messages.unsubscribeFailure));
|
||||||
|
|
||||||
const onNotifyToggle = () => {
|
const onNotifyToggle = () => {
|
||||||
if (account.relationship?.notifying) {
|
if (account.relationship?.notifying) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { confirmEmailVerification } from 'soapbox/actions/verification';
|
import { confirmEmailVerification } from 'soapbox/actions/verification';
|
||||||
import { Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
import { Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||||
|
@ -145,7 +144,7 @@ const EmailPassThru = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(snackbar.error(message));
|
toast.error(message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { Redirect } from 'react-router-dom';
|
||||||
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import { fetchInstance } from 'soapbox/actions/instance';
|
import { fetchInstance } from 'soapbox/actions/instance';
|
||||||
import { startOnboarding } from 'soapbox/actions/onboarding';
|
import { startOnboarding } from 'soapbox/actions/onboarding';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { createAccount, removeStoredVerification } from 'soapbox/actions/verification';
|
import { createAccount, removeStoredVerification } from 'soapbox/actions/verification';
|
||||||
import { Button, Form, FormGroup, Input, Text } from 'soapbox/components/ui';
|
import { Button, Form, FormGroup, Input, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useAppSelector, useInstance, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useInstance, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
|
@ -61,17 +60,9 @@ const Registration = () => {
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
if (error?.response?.status === 422) {
|
if (error?.response?.status === 422) {
|
||||||
dispatch(
|
toast.error(intl.formatMessage(messages.usernameTaken));
|
||||||
snackbar.error(
|
|
||||||
intl.formatMessage(messages.usernameTaken),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
toast.error(intl.formatMessage(messages.error));
|
||||||
snackbar.error(
|
|
||||||
intl.formatMessage(messages.error),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, [username, password]);
|
}, [username, password]);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { verifyAge } from 'soapbox/actions/verification';
|
import { verifyAge } from 'soapbox/actions/verification';
|
||||||
import { Button, Datepicker, Form, Text } from 'soapbox/components/ui';
|
import { Button, Datepicker, Form, Text } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useAppSelector, useInstance } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useInstance } from 'soapbox/hooks';
|
||||||
|
import toast from 'soapbox/toast';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
fail: {
|
fail: {
|
||||||
|
@ -42,9 +42,7 @@ const AgeVerification = () => {
|
||||||
if (meetsAgeMinimum(birthday, ageMinimum)) {
|
if (meetsAgeMinimum(birthday, ageMinimum)) {
|
||||||
dispatch(verifyAge(birthday));
|
dispatch(verifyAge(birthday));
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
toast.error(intl.formatMessage(messages.fail, { ageMinimum }));
|
||||||
snackbar.error(intl.formatMessage(messages.fail, { ageMinimum })),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}, [date, ageMinimum]);
|
}, [date, ageMinimum]);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue