refactor: replace Toast with Sonner
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
} from "../../../services/api";
|
||||
|
||||
import { useScriptWorkspaceStore } from "../../platform/state/scriptWorkspaceStore";
|
||||
import { useUiStore } from "../../platform/state/uiStore";
|
||||
import { toast } from "sonner";
|
||||
|
||||
type Notice = {
|
||||
tone: "success" | "error" | "info";
|
||||
@@ -65,7 +65,9 @@ function requireApi(): WorkspaceBoundApi {
|
||||
}
|
||||
|
||||
function pushToast(notice: Notice) {
|
||||
useUiStore.getState().pushToast(notice);
|
||||
if (notice.tone === "error") toast.error(notice.message);
|
||||
else if (notice.tone === "info") toast.info(notice.message);
|
||||
else toast.success(notice.message);
|
||||
}
|
||||
|
||||
function setApiOnline(online: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user