From 1b6fb6f77d8eceeca39288673fc9217691fb2126 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Fri, 3 Apr 2026 21:42:52 +0900 Subject: [PATCH] =?UTF-8?q?wr:=20(with-layout)=20toast=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../matMng/coMat/ruseRvwHstry/page.tsx | 22 +------------------ .../matMng/coMng/coSttn/page.tsx | 3 +-- .../ruseFcltMng/fcltSttn/htdflSttn/page.tsx | 7 +++--- .../ruseFcltMng/fcltSttn/pbnstSttn/page.tsx | 7 +++--- .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 7 +++--- .../ruseFcltMng/fcltSttn/rswtSttn/page.tsx | 7 +++--- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 9 ++++---- .../prfmncReg/pbnstPrfmncReg/page.tsx | 13 ++++++----- .../prfmncSttn/chkgdnSttn/page.tsx | 9 ++++---- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 11 +++++----- .../app/(with-layout)/stats/rainStat/page.tsx | 7 +++--- .../app/(with-layout)/stats/rswtStat/page.tsx | 7 +++--- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 13 ++++++----- 13 files changed, 57 insertions(+), 65 deletions(-) diff --git a/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx index 1732db4d8..a8800273b 100644 --- a/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx @@ -1,4 +1,4 @@ -/** +/** * 수요처매칭 > 재이용검토이력 */ "use client"; @@ -163,26 +163,6 @@ export default function RuseRvwHstry() { // const handleConfirm = async () => { // ruseRvwComplete(completeData as number[]); // }; - // toast((t) => ( - // - // 매칭완료를 진행하시겠습니까? - //
- //
- // - // - //
- //
- // )); } else { alert(t('isNotMatchFinishMsg')); } diff --git a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx index 8e82c8c0d..71ec60cf0 100644 --- a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; /** * 수요처관리 @@ -184,7 +184,6 @@ export default function CoSttn() { } } else { alert("비밀번호 초기화를 원하는 행을 선택해주세요."); - // toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.") } } diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index 07b99d5b8..2f31e616c 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -1,4 +1,4 @@ -/** +/** * 온배수시설 현황 */ "use client"; @@ -34,7 +34,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function HtdflSttn() { @@ -58,6 +58,7 @@ export default function HtdflSttn() { // chBuilding: chgBuilding[]; // }>({ isOpen: false, chBuilding: [] }); const [fcltNm, setFcltNm] = useState(""); + const alert = useAlertStore((state) => state.setMessage); console.log("laeSeCd : ", laeSeCd); useEffect(() => { @@ -128,7 +129,7 @@ export default function HtdflSttn() { sheetArray ); } else { - toast.error(t('excelDownErrMsg')); + alert(t('excelDownErrMsg')); } isDownloadTriggered.current = false; }, [htdflSttn.excelList, code]); diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index 53c41a17d..3e085ea89 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -1,4 +1,4 @@ -/** +/** * 하수재이용 시설 현황 * 재이용시설 현황 - 하수재이용시설 현황 * - layout.tsx에 의해 공통 레이아웃이 적용됨 @@ -30,7 +30,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; @@ -61,6 +61,7 @@ export default function PbnstSttn() { const isDownloadTriggered = useRef(false); const [pbnRuseNm, setPbnRuseNm] = useState(""); const { t } = useTranslation("base"); + const alert = useAlertStore((state) => state.setMessage); const excelClick = useCallback(() => { isDownloadTriggered.current = true; pbnstSttnSearch( @@ -119,7 +120,7 @@ export default function PbnstSttn() { sheetArray ); } else { - toast.error(t("excelDownErrMsg")); + alert(t("excelDownErrMsg")); } isDownloadTriggered.current = false; }, [pbnstSttn.excelList]); diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rainSttn/page.tsx index bf6601164..9de317a08 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -1,4 +1,4 @@ -/** +/** * 빗물이용시설 현황 */ "use client"; @@ -32,7 +32,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function RainSttn() { @@ -58,6 +58,7 @@ export default function RainSttn() { const [fcltNm, setFcltNm] = useState(""); const { t } = useTranslation("base"); + const alert = useAlertStore((state) => state.setMessage); const cellClick = (index: number | undefined) => { if (index !== undefined && bdstTable !== undefined) { @@ -173,7 +174,7 @@ export default function RainSttn() { sheetArray ); } else { - toast.error(t("excelDownErrMsg")); + alert(t("excelDownErrMsg")); } isDownloadTriggered.current = false; }, [rainSttn.excelList]); diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rswtSttn/page.tsx index ac53229d0..c95c7aafe 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rswtSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -1,4 +1,4 @@ -/** +/** * 중수도시설 현황 */ "use client"; @@ -32,7 +32,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function RswtSttn() { @@ -52,6 +52,7 @@ export default function RswtSttn() { const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false }) const [fcltNm, setFcltNm] = useState(""); const { t } = useTranslation('base'); + const alert = useAlertStore((state) => state.setMessage); const cellClick = (index: number | undefined) => { if ( index !== undefined && bdstTable !== undefined) { @@ -143,7 +144,7 @@ export default function RswtSttn() { sheetArray ); } else { - toast.error(t('excelDownErrMsg')); + alert(t('excelDownErrMsg')); } isDownloadTriggered.current = false; }, [rswtSttn.excelList]); diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 4577ef3e8..8e7ff98cb 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; @@ -38,7 +38,7 @@ import { TooltipTrigger, } from "@common/components/ui/tooltip"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function Page() { @@ -237,6 +237,7 @@ export default function Page() { }, [rainChkgdn.isSttn, rswtChkgdn.isSttn]); const { t } = useTranslation('base'); + const alert = useAlertStore((state) => state.setMessage); const clickDelete = async (data: number[], selFcltDiv: string) => { if (data.length > 0) { if (selFcltDiv === "RNB") { @@ -261,13 +262,13 @@ export default function Page() { if (updateRainDetail && updateRainDetail.length > 0) { rainChkDetilUpdate(updateRainDetail, searchYear); } else { - toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + alert("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); } } else { if (updateRswtDetail && updateRswtDetail.length > 0) { rswtChkDetilsUpdate(updateRswtDetail, searchYear); } else { - toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + alert("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); } } }; diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index f87ac44f5..96d44fe36 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel"; @@ -37,7 +37,7 @@ import { TableHeader, } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; import { headMakeprfmnc } from "../chkgdnReg/TableHead"; @@ -73,6 +73,7 @@ export default function PrfmncPrfmncReg() { String(new Date().getFullYear()) ); const { confirm } = useConfirm(); + const alert = useAlertStore((state) => state.setMessage); const useInitRef = useRef(false); @@ -90,7 +91,7 @@ export default function PrfmncPrfmncReg() { const handleConfirm = async () => { if (!pbnstRuseFcltId) return; - prfmnRegData( + const message = await prfmnRegData( 1, laeSeCd, excelToPbnPrfData( @@ -101,6 +102,7 @@ export default function PrfmncPrfmncReg() { searchYear, prfPbnFclts ); + alert(message); }; if (await confirm(t("isUpdateMsg"))) { @@ -287,7 +289,7 @@ export default function PrfmncPrfmncReg() { className={btnClass} onClick={() => { if (cellNum === undefined) { - toast.error("하수처리재이용시설을 선택해주세요."); + alert("하수처리재이용시설을 선택해주세요."); return; } else { setIsExcelOPen({ ...isExcelOpen, isModal: true }); @@ -374,7 +376,8 @@ export default function PrfmncPrfmncReg() { setIsExcelOPen({ ...isExcelOpen, isModal: open }); }} setModalExcelData={async (excelData) => { - await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts); + const message = await prfmnRegData(1, laeSeCd, excelData, searchYear, prfPbnFclts); + alert(message); // 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다. }} > diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index 43cc6874d..4e675954a 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; @@ -21,7 +21,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function Page() { @@ -137,13 +137,14 @@ export default function Page() { [isModal] ); const { t } = useTranslation("base"); + const alert = useAlertStore((state) => state.setMessage); const excelDown = () => { if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") { if ( !rainChkSttn.sttnExcelList || rainChkSttn.sttnExcelList.length === 0 ) { - toast.error(t("excelDownErrMsg")); + alert(t("excelDownErrMsg")); return; } // console.log(rainChkSttn.sttnExcelList); @@ -165,7 +166,7 @@ export default function Page() { !rswtChkSttn.sttnExcelList || rswtChkSttn.sttnExcelList.length === 0 ) { - toast.error(t("excelDownErrMsg")); + alert(t("excelDownErrMsg")); return; } const sheetArray: SheetParameter[] = [{ diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index fc790ea26..adb93cf22 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; @@ -11,7 +11,7 @@ import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchI import ListDiv from "@common/business_components/ui/list_div"; import { Label, Table, TableBody, TableHeader } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead"; @@ -37,6 +37,7 @@ export default function PbnstPrfmncSttn() { // const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(); const [pbnRuseNm, setPbnRuseNm] = useState(""); const { t } = useTranslation('base'); + const alert = useAlertStore((state) => state.setMessage); const searchYear = String(new Date().getFullYear()); const [excelData, setExcelData] = useState([]); const [pageNation, setPageNation] = useState(1); @@ -44,7 +45,7 @@ export default function PbnstPrfmncSttn() { const excelClick = useCallback(() => { if (!excelData || excelData.length === 0) { - toast.error(t('excelDownErrMsg')); + alert(t('excelDownErrMsg')); return; } const sheetArray: SheetParameter[] = [{ @@ -598,10 +599,10 @@ export default function PbnstPrfmncSttn() { const fromNum = Number(fromDate); const toNum = Number(toDate); if (fromNum > toNum) { - toast.error("시작년도가 종료년도 이후로 설정할 수 없습니다."); + alert("시작년도가 종료년도 이후로 설정할 수 없습니다."); } else { if (toNum - fromNum > 4) { - toast.error("최대 5년까지 선택 가능합니다."); + alert("최대 5년까지 선택 가능합니다."); } else { tableHeadMaker(fromNum, toNum); diff --git a/apps/wr/app/(with-layout)/stats/rainStat/page.tsx b/apps/wr/app/(with-layout)/stats/rainStat/page.tsx index 72d339d24..332ae537f 100644 --- a/apps/wr/app/(with-layout)/stats/rainStat/page.tsx +++ b/apps/wr/app/(with-layout)/stats/rainStat/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; @@ -17,7 +17,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function RainStat() { @@ -30,6 +30,7 @@ export default function RainStat() { //const [exData, setExData] = useState>>(); const [bdstTable, setBdstTable] = useState(); const { t } = useTranslation('base'); + const alert = useAlertStore((state) => state.setMessage); useEffect(() => { searchRainStatList(searchYear ,code.cityCd); @@ -184,7 +185,7 @@ export default function RainStat() { decimalArray0: [1,2,3,4,5,6,7,8,9,10,11,12], // 0부터 시작 }) }else{ - toast.error(t('excelDownErrMsg')); + alert(t('excelDownErrMsg')); } } diff --git a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx index 9fa896555..3e3e26dcf 100644 --- a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx +++ b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import type { RswtStatProps } from "@/app/store/stats/rswtStat"; @@ -15,7 +15,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; export default function RswtStat() { @@ -27,6 +27,7 @@ export default function RswtStat() { ); const { t } = useTranslation('base'); + const alert = useAlertStore((state) => state.setMessage); useEffect(() => { searchRswtStatList(searchYear, code.cityCd, code.rswtBdstType); }, [searchRswtStatList, code.cityCd]) @@ -62,7 +63,7 @@ export default function RswtStat() { decimalArray0: [1,2,3,4,5,6,7,8,9,10,11,12,13], // 0부터 시작 }) } else { - toast.error(t("excelDownErrMsg")) + alert(t("excelDownErrMsg")) } } diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index 13429fbc7..83057114c 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -1,4 +1,4 @@ -/** +/** * 재이용실적등록 > 하수재이용실적등록 * * 🔗 사용 API @@ -13,7 +13,6 @@ import { pbnstPrfmncHeadListExport, monthHeadListExport } from "./headList"; import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type"; import type { FcPrfType, PrfType } from "./type"; import type { TableUpperProps } from "../../common/type/header"; -import toast from "react-hot-toast"; const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport; const monthHeadList = monthHeadListExport; @@ -66,7 +65,7 @@ type pbnstPrfmncActions = { data: PrfType, year: string, prfPbnFclts: string[] - ) => void; + ) => Promise; getPrfFmcRes: () => void; }; @@ -203,6 +202,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( year: string, prfPbnFclts: string[] ) => { + const failMessage = "하수재이용 시설 실적 등록이 실패하였습니다."; try { const ressponse = await postFectch( "/reuseFc/pubFcPrf", @@ -211,7 +211,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( ); if (ressponse.status === 200) { - toast.success("하수재이용 시설 실적 등록이 완료되었습니다."); const prfmncRes = await hasuListFetch( page, sggOrCity, @@ -219,7 +218,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( prfPbnFclts ); - return set((state: pbnstPrfmncState) => ({ + set((state: pbnstPrfmncState) => ({ ...state, prfmnc: { ...state.prfmnc, @@ -229,10 +228,12 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( pageKey: state.prfmnc.pageKey + 1, }, })); + return "하수재이용 시설 실적 등록이 완료되었습니다."; } + return failMessage; } catch (e) { console.log(e); - toast.error("하수재이용 시설 실적 등록이 실패하였습니다."); + return failMessage; } }, };