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,8 +2,8 @@ import invariant from "invariant";
import * as React from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { toast } from "sonner";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
import { documentPath } from "~/utils/routeHelpers";
let importingLock = false;
@@ -16,7 +16,6 @@ export default function useImportDocument(
isImporting: boolean;
} {
const { documents } = useStores();
const { showToast } = useToasts();
const [isImporting, setImporting] = React.useState(false);
const { t } = useTranslation();
const history = useHistory();
@@ -55,15 +54,13 @@ export default function useImportDocument(
}
}
} catch (err) {
showToast(`${t("Could not import file")}. ${err.message}`, {
type: "error",
});
toast.error(`${t("Could not import file")}. ${err.message}`);
} finally {
setImporting(false);
importingLock = false;
}
},
[t, documents, history, showToast, collectionId, documentId]
[t, documents, history, collectionId, documentId]
);
return {