refactor toast system to use react-hot-toast
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-11 21:09:45 +01:00
parent 03384c1bda
commit cff416dd83
12 changed files with 151 additions and 132 deletions
+7 -5
View File
@@ -2,7 +2,8 @@
import { useEffect, useRef } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { toast } from "sonner";
import { toast } from "@/lib/toast";
const TOAST_PARAM_NAMES = ["success", "error"] as const;
const PENDING_TOAST_STORAGE_KEY = "mohfarawati-pending-toast";
@@ -25,17 +26,18 @@ export function QueryToastBridge() {
message?: string;
type?: "success" | "error";
};
const localizedMessage = pendingToast.message;
if (!pendingToast.message) {
if (!localizedMessage) {
return;
}
if (pendingToast.type === "error") {
toast.error(pendingToast.message);
toast.error(localizedMessage);
} else if (pendingToast.type === "success") {
toast.success(pendingToast.message);
toast.success(localizedMessage);
} else {
toast(pendingToast.message);
toast(localizedMessage);
}
} finally {
window.sessionStorage.removeItem(PENDING_TOAST_STORAGE_KEY);