Move toasts to sonner (#6053)

This commit is contained in:
Tom Moor
2023-10-22 17:30:24 -04:00
committed by GitHub
parent 389297a337
commit ef76405bd6
92 changed files with 363 additions and 1015 deletions

View File

@@ -2,13 +2,13 @@ import { observer } from "mobx-react";
import * as React from "react";
import { useForm } from "react-hook-form";
import { useTranslation, Trans } from "react-i18next";
import { toast } from "sonner";
import Button from "~/components/Button";
import Flex from "~/components/Flex";
import Input from "~/components/Input";
import Text from "~/components/Text";
import env from "~/env";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
type FormData = {
code: string;
@@ -17,7 +17,6 @@ type FormData = {
function UserDelete() {
const [isWaitingCode, setWaitingCode] = React.useState(false);
const { auth } = useStores();
const { showToast } = useToasts();
const { t } = useTranslation();
const {
register,
@@ -32,13 +31,11 @@ function UserDelete() {
try {
await auth.requestDeleteUser();
setWaitingCode(true);
} catch (error) {
showToast(error.message, {
type: "error",
});
} catch (err) {
toast.error(err.message);
}
},
[auth, showToast]
[auth]
);
const handleSubmit = React.useCallback(
@@ -46,13 +43,11 @@ function UserDelete() {
try {
await auth.deleteUser(data);
await auth.logout();
} catch (error) {
showToast(error.message, {
type: "error",
});
} catch (err) {
toast.error(err.message);
}
},
[auth, showToast]
[auth]
);
const inputProps = register("code", {