From dea00470074389bca1c8416aa30ef8b4a163ce40 Mon Sep 17 00:00:00 2001 From: Md Asif Date: Tue, 24 Dec 2024 00:01:29 +0530 Subject: [PATCH] refactor: replace inline notification handling with Notification component in LockerStatus --- src/pages/LockerStatus.jsx | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/pages/LockerStatus.jsx b/src/pages/LockerStatus.jsx index 3aaddea..cab2580 100644 --- a/src/pages/LockerStatus.jsx +++ b/src/pages/LockerStatus.jsx @@ -9,7 +9,8 @@ import clsx from "clsx"; import Button from "../components/Button"; import { lockerService } from "../services/locker.service"; import { useLoading } from "../hooks/useLoading"; -import { AnimatePresence, motion } from "motion/react"; +import { AnimatePresence } from "motion/react"; +import Notification from "../components/Notification"; function LockerStatus() { const { t } = useTranslation(); @@ -93,7 +94,11 @@ function LockerStatus() { type: "success", }); } catch (error) { - showToast(error.response.data.message, "error"); + setNotification({ + visible: true, + message: error.message, + type: "error", + }); } finally { setIsLoading(false); } @@ -130,21 +135,7 @@ function LockerStatus() { return (
- {notification.visible && ( - - {notification.message} - - )} + {notification.visible && }
{notification.type === "success" && (