Move toasts to sonner (#6053)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user