Move toasts to sonner (#6053)
This commit is contained in:
@@ -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("Couldn’t create the document, try again?"), {
|
||||
type: "error",
|
||||
});
|
||||
toast.error(t("Couldn’t create the document, try again?"));
|
||||
history.goBack();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user