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

@@ -3,13 +3,13 @@ import * as React from "react";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useHistory, useLocation, useRouteMatch } from "react-router-dom";
import { toast } from "sonner";
import CenteredContent from "~/components/CenteredContent";
import Flex from "~/components/Flex";
import PlaceholderDocument from "~/components/PlaceholderDocument";
import useCurrentUser from "~/hooks/useCurrentUser";
import useQuery from "~/hooks/useQuery";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
import { documentEditPath, documentPath } from "~/utils/routeHelpers";
type Props = {
@@ -25,7 +25,6 @@ function DocumentNew({ template }: Props) {
const match = useRouteMatch<{ id?: string }>();
const { t } = useTranslation();
const { documents, collections } = useStores();
const { showToast } = useToasts();
const id = match.params.id || query.get("collectionId");
useEffect(() => {
@@ -56,9 +55,7 @@ function DocumentNew({ template }: Props) {
location.state
);
} catch (err) {
showToast(t("Couldnt create the document, try again?"), {
type: "error",
});
toast.error(t("Couldnt create the document, try again?"));
history.goBack();
}
}