From c57c7ce1f71afc391266133b8025a5c00a0eefb4 Mon Sep 17 00:00:00 2001
From: ljpark
Date: Tue, 17 Mar 2026 18:05:02 +0900
Subject: [PATCH] =?UTF-8?q?wr:=20=EA=B3=B5=ED=86=B5=20alet=20=20=EC=82=AC?=
=?UTF-8?q?=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../matMng/coMng/coSttn/page.tsx | 29 +++++++++++--------
apps/wr/app/store/matDmd/coSttn/index.tsx | 17 +++++------
apps/wr/src/shared/ui/confirm-dialog.tsx | 24 ++++++++-------
3 files changed, 38 insertions(+), 32 deletions(-)
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 bf471c564..f5fcf7d91 100644
--- a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx
+++ b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx
@@ -5,7 +5,7 @@ import { btnClass } from "@/app/store/common/code";
import { excelCoSttnParsing } from "@/app/store/matDmd/coSttn/excel";
import { fetchType, getFetch } from "@/components/lib/api";
import {
- confirmToast,
+ //confirmToast,
excelDownload,
formatPhoneNumber,
getCity,
@@ -29,9 +29,10 @@ import type { DemandCompType } from "@common/business_components/ui/sdmInsertFor
import { Button } from "@common/components/ui";
import moment from "moment";
import { useCallback, useEffect, useState } from "react";
-import toast, { Toaster } from "react-hot-toast";
+// import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { useAlertStore } from "@/src/shared/lib";
+import { useConfirm } from "@frontend-opensource/use-react-hooks";
export default function CoSttn() {
const {
@@ -50,6 +51,7 @@ export default function CoSttn() {
} = useWrStore((state) => state);
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const alert = useAlertStore((state) => state.setMessage);
+ const { confirm } = useConfirm();
const [bdstTable, setBdstTable] = useState();
const [pageNation, setPageNation] = useState(1);
const { coSttnRes, coSttnResCount } = coSttn;
@@ -168,16 +170,21 @@ export default function CoSttn() {
}
};
const { t } = useTranslation('base');
- const initPassword = () => {
+ const initPassword = async () => {
if (updateData) {
const dmdInfoId = updateData.dmdInfoId;
const dmdInfoSliceId = `${dmdInfoId.slice(0, 3)}-${dmdInfoId.slice(3, 5)}-${dmdInfoId.slice(5, 10)}-${dmdInfoId.slice(10)}`
- const handleConfirm = () => {
- coSttnPwInit(dmdInfoId);
+ const handleConfirm = async () => {
+ const message = await coSttnPwInit(dmdInfoId);
+ alert(message);
};
- confirmToast( t('isInitPw', { dmdInfoId: dmdInfoSliceId }), handleConfirm, 'text-2xl');
+ //confirmToast( t('isInitPw', { dmdInfoId: dmdInfoSliceId }), handleConfirm, 'text-2xl');
+ if (await confirm(t('isInitPw', { dmdInfoId: dmdInfoSliceId }))) {
+ await handleConfirm();
+ }
} else {
- toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.")
+ alert("비밀번호 초기화를 원하는 행을 선택해주세요.");
+ // toast.error("비밀번호 초기화를 원하는 행을 선택해주세요.")
}
}
@@ -239,7 +246,7 @@ export default function CoSttn() {
onClick={() => {
/* 저장 로직 */
if (!updateData) {
- toast.error("수요처 변경을 원하는 행을 선택해주세요");
+ alert("수요처 변경을 원하는 행을 선택해주세요");
} else {
setIsDmdModal({
...isDmdModal,
@@ -333,9 +340,7 @@ export default function CoSttn() {
`/reuseFc/request/${data.dmdInfoId}`
);
if (dmd) {
- alert(
- `사업자번호 ${dmd.dmdInfoId}는 이미 등록되었습니다. 다시등록해주세요`
- );
+ alert(`사업자번호 ${dmd.dmdInfoId}는 이미 등록되었습니다. 다시등록해주세요`);
return;
}
await regDemandCompany(data as DemandCompType);
@@ -353,7 +358,7 @@ export default function CoSttn() {
}
>
-
+ {/* */}
>
);
}
diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx
index 4c326d283..ca610c381 100644
--- a/apps/wr/app/store/matDmd/coSttn/index.tsx
+++ b/apps/wr/app/store/matDmd/coSttn/index.tsx
@@ -2,7 +2,6 @@ import type { CommonTableProps } from "@/app/store/common/type/header";
import { fetchType, getFetchWithCount, putFectch } from "@/components/lib/api";
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
-import toast from "react-hot-toast";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
@@ -25,7 +24,7 @@ type coSttnActions = {
coSttnInit: (pageNo: string, pageCnt: string, con: string) => void;
coSttnSearch: (pageNo: string, pageCnt: string, con: string) => void;
coSttnTxtSearch: (pageNo: string, pageCnt: string, con: string, txt: string) => void;
- coSttnPwInit: (dmdInfoId: string) => void;
+ coSttnPwInit: (dmdInfoId: string) => Promise;
};
export type coSttnType = coSttnState & coSttnActions;
@@ -127,10 +126,14 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
try {
const response = await putFectch(`/reuseFc/request/chgPassword/${dmdInfoId}`,[])
if (response.status === 200) {
- toast.success('비밀번호가 초기화 되었습니다.')
+ return "비밀번호가 초기화되었습니다.";
} else {
- toast.error('비밀번호 초기화에 실패하였습니다')
+ return "비밀번호 초기화에 실패하였습니다.";
}
+ } catch (err) {
+ console.log(err);
+ return "비밀번호 초기화에 실패하였습니다.";
+ } finally {
set((state: coSttnState) => {
return {
...state,
@@ -140,11 +143,7 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
}
}
});
- } catch (err) {
- console.log(err);
- toast.error('비밀번호 초기화에 실패하였습니다.')
-
}
}
}
-}
\ No newline at end of file
+}
diff --git a/apps/wr/src/shared/ui/confirm-dialog.tsx b/apps/wr/src/shared/ui/confirm-dialog.tsx
index 6a4996bfb..7a8065a98 100644
--- a/apps/wr/src/shared/ui/confirm-dialog.tsx
+++ b/apps/wr/src/shared/ui/confirm-dialog.tsx
@@ -28,17 +28,19 @@ function ConfirmDialog({
{message}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+