diff --git a/apps/as/src/pages/instl-sncn/ui/components/floating-action-buttons.tsx b/apps/as/src/pages/instl-sncn/ui/components/floating-action-buttons.tsx
index 6f78e7951..1bbafa208 100644
--- a/apps/as/src/pages/instl-sncn/ui/components/floating-action-buttons.tsx
+++ b/apps/as/src/pages/instl-sncn/ui/components/floating-action-buttons.tsx
@@ -5,6 +5,7 @@ import { useRouter } from "next/navigation";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import { useQueryClient } from "@tanstack/react-query";
+import { AxiosError } from "axios";
import { useAlertStore, useUserStore } from "@/shared/lib";
import { type ElaprDmndSaveRequestDto, elaprDmndService, type ElaprTmplt } from "@/entities/elapr";
@@ -120,7 +121,13 @@ function FloatingActionButtons({
});
},
onError: (error) => {
- alert(error.message || "처리 중 오류가 발생했습니다.");
+ let errorMessage = "";
+ if (error instanceof AxiosError) {
+ errorMessage = error.response?.data?.message ?? "";
+ } else {
+ errorMessage = error.message ?? "처리 중 오류가 발생했습니다.";
+ }
+ alert(errorMessage);
},
});
} finally {
@@ -436,23 +443,15 @@ function FloatingActionButtons({
결재(회신)
)}
- {shouldShowButton(INSTL_SNCN_VIEW_BUTTON_ACTION.grndsChck) && (
-
- )}
+
setActiveDialog(null)}
onSelect={handleElaprTmpltSelect}
/>
+
setActiveDialog(null)}
@@ -461,6 +460,7 @@ function FloatingActionButtons({
isSubmitting={isProcessing}
onConfirm={(value) => void handleDmndSplmntConfirm(value)}
/>
+
setActiveDialog(open ? "elaprApproval" : null)}
@@ -480,18 +480,7 @@ function FloatingActionButtons({
export { FloatingActionButtons };
-async function handleStrg(
- context: ActionHandlerContext,
-): Promise {
- try {
- await instlSncnService.saveApply(context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
-async function handleAply(
+async function handleSaveApply(
context: ActionHandlerContext,
): Promise {
try {
@@ -516,16 +505,7 @@ async function handleSplmntCmptn(context: ActionHandlerContext): Promise {
context.onSuccess?.();
}
-async function handleInstlSncnAncmnt(context: ActionHandlerContext): Promise {
- try {
- await instlSncnService.changePrgrsSttsComCd(context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
-async function handleEnvoSbmsn(
+async function handleChangePrgrsSttsComCd(
context: ActionHandlerContext,
): Promise {
try {
@@ -536,25 +516,7 @@ async function handleEnvoSbmsn(
}
}
-async function handleRjct(context: ActionHandlerContext): Promise {
- try {
- await instlSncnService.changePrgrsSttsComCd(context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
-async function handleSncnAprv(context: ActionHandlerContext): Promise {
- try {
- await instlSncnService.changePrgrsSttsComCd(context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
-async function handleRvwRply(
+async function handleTechReview(
context: ActionHandlerContext,
): Promise {
try {
@@ -565,15 +527,6 @@ async function handleRvwRply(
}
}
-async function handleRqstTechRvw(context: ActionHandlerContext): Promise {
- try {
- await instlSncnService.changePrgrsSttsComCd(context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
async function handleDsgntRvwr(
context: ActionHandlerContext,
): Promise {
@@ -585,28 +538,6 @@ async function handleDsgntRvwr(
}
}
-async function handleRvwStrg(
- context: ActionHandlerContext,
-): Promise {
- try {
- await instlSncnService.techReview(context.data.detDto.instlSncnDocNo, context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
-async function handleRvwCmptn(
- context: ActionHandlerContext,
-): Promise {
- try {
- await instlSncnService.techReview(context.data.detDto.instlSncnDocNo, context.request);
- context.onSuccess?.();
- } catch (error) {
- context.onError?.(error as Error);
- }
-}
-
async function handleDmndSplmnt(context: ActionHandlerContext): Promise {
// TODO: 보완요청 API 호출
context.onSuccess?.();
@@ -628,19 +559,19 @@ async function handleGrndsChck(context: ActionHandlerContext): Promise {
}
const buttonActionHandlers: Record = {
- strg: handleStrg,
- aply: handleAply,
+ strg: handleSaveApply,
+ aply: handleSaveApply,
del: handleDel,
splmntCmptn: handleSplmntCmptn,
- instlSncnAncmnt: handleInstlSncnAncmnt,
- envoSbmsn: handleEnvoSbmsn,
- rjct: handleRjct,
- sncnAprv: handleSncnAprv,
- rvwRply: handleRvwRply,
- rqstTechRvw: handleRqstTechRvw,
+ instlSncnAncmnt: handleChangePrgrsSttsComCd,
+ envoSbmsn: handleChangePrgrsSttsComCd,
+ rjct: handleChangePrgrsSttsComCd,
+ sncnAprv: handleChangePrgrsSttsComCd,
+ rvwRply: handleTechReview,
+ rqstTechRvw: handleChangePrgrsSttsComCd,
dsgntRvwr: handleDsgntRvwr,
- rvwStrg: handleRvwStrg,
- rvwCmptn: handleRvwCmptn,
+ rvwStrg: handleTechReview,
+ rvwCmptn: handleTechReview,
dmndSplmnt: handleDmndSplmnt,
atrzAprv: handleAtrzAprv,
atrzRply: handleAtrzRply,