From 9d9bfa8aa87d977509ae623325ed6d509201f831 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Mon, 5 May 2025 23:25:28 +0500 Subject: [PATCH] add close to notif --- gui/app/pack/new/page.tsx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gui/app/pack/new/page.tsx b/gui/app/pack/new/page.tsx index 4ed230c..c065bc4 100644 --- a/gui/app/pack/new/page.tsx +++ b/gui/app/pack/new/page.tsx @@ -13,7 +13,7 @@ import { toast } from "react-toastify"; const mcr = mc.reverse(); export default function PackNew() { - const router = useRouter() + const router = useRouter(); const [image, setImage] = useState(null); const [imageMime, setImageMime] = useState(null); const [packInfo, setPackInfo] = useState({ @@ -50,7 +50,7 @@ export default function PackNew() { e.preventDefault(); async function _submit() { - const tid = toast.loading(`Creating Pack "${packInfo.title}"`) + const tid = toast.loading(`Creating Pack "${packInfo.title}"`); const res = await fetch(PACKS_ENDPOINT("createPack"), { method: "POST", @@ -63,7 +63,14 @@ export default function PackNew() { const data = await res.json(); if (data.status != "ok") { - toast.update(tid, {render: data.message, type: "error", isLoading: false}) + toast.update(tid, { + render: data.message, + type: "error", + isLoading: false, + autoClose: 2500, + closeOnClick: true, + draggable: true, + }); return; } @@ -72,7 +79,7 @@ export default function PackNew() { method: "POST", body: JSON.stringify({ image: image, - mimetype: imageMime + mimetype: imageMime, }), headers: { "content-type": "application/json", @@ -81,8 +88,15 @@ export default function PackNew() { }); } - toast.update(tid, {render: data.message, type: "success", isLoading: false}) - router.push(`/pack/?id=${data.id}`) + toast.update(tid, { + render: data.message, + type: "success", + isLoading: false, + autoClose: 2500, + closeOnClick: true, + draggable: true, + }); + router.push(`/pack/?id=${data.id}`); } _submit();