[as] refactor: 행정지원 쿼리키 관리 방식 변경
This commit is contained in:
@@ -11,7 +11,7 @@ import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
type DesignCnstnApplySaveRequestDto,
|
||||
designCnstnMngBaseKey,
|
||||
designCnstnKeys,
|
||||
type DesignCnstnMngDetResponseDto,
|
||||
designCnstnMngService,
|
||||
} from "@/entities/design-cnstn";
|
||||
@@ -134,7 +134,7 @@ function FloatingActionButtons({
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
|
||||
queryKey: designCnstnKeys.detail(designCnstnDocNo),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -168,7 +168,7 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
@@ -306,7 +306,7 @@ function FloatingActionButtons({
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
|
||||
queryKey: designCnstnKeys.detail(designCnstnDocNo),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ function DesignEditPage({ id }: DesignEditPageProps) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <DesignFormPage id={id} mode="edit" initialData={data} />;
|
||||
return <DesignFormPage mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { DesignEditPage };
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
type DesignCnstnApplySaveRequestDto,
|
||||
designCnstnMngBaseKey,
|
||||
designCnstnKeys,
|
||||
type DesignCnstnMngDetResponseDto,
|
||||
designCnstnMngService,
|
||||
} from "@/entities/design-cnstn";
|
||||
@@ -37,7 +37,6 @@ import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
|
||||
interface DesignFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: DesignCnstnMngDetResponseDto;
|
||||
createDefaults?: {
|
||||
@@ -48,7 +47,7 @@ interface DesignFormPageProps {
|
||||
};
|
||||
}
|
||||
|
||||
function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPageProps) {
|
||||
function DesignFormPage({ mode, initialData, createDefaults }: DesignFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
@@ -103,11 +102,7 @@ function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPag
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/design-cnstn/${designCnstnDocNo}/edit`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -131,12 +126,7 @@ function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPag
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/design-cnstn/${designCnstnDocNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
if (id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
import {
|
||||
type DocPrgrsUpdateRequestDto,
|
||||
type FnrsCnsltnApplySaveRequestDto,
|
||||
fnrsCnsltnMngBaseKey,
|
||||
fnrsCnsltnKeys,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
@@ -145,7 +145,7 @@ function FloatingActionButtons({
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -201,7 +201,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
@@ -224,7 +223,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "고시되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleEnvoSbmsnClick() {
|
||||
@@ -238,7 +236,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "제출되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleRjctClick() {
|
||||
@@ -252,7 +249,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "반려되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleSncnAprvClick() {
|
||||
@@ -266,7 +262,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "인가승인되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
function getReviewOpinionFormData() {
|
||||
@@ -314,7 +309,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "기술검토 의뢰가 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleElaprTmpltConfirm({ aplnRows }: ElaprTmpltPickerConfirmPayload) {
|
||||
@@ -512,7 +506,7 @@ function FloatingActionButtons({
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ function FnrsEditPage({ id }: FnrsEditPageProps) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <FnrsFormPage id={id} mode="edit" initialData={data} />;
|
||||
return <FnrsFormPage mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { FnrsEditPage };
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useAcntgSeMngTree } from "@/entities/acntg";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import {
|
||||
type FnrsCnsltnApplySaveRequestDto,
|
||||
fnrsCnsltnMngBaseKey,
|
||||
fnrsCnsltnKeys,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
@@ -48,7 +48,6 @@ import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
interface FnrsFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: FnrsCnsltnMngDetResponseDto;
|
||||
createDefaults?: {
|
||||
@@ -59,7 +58,7 @@ interface FnrsFormPageProps {
|
||||
};
|
||||
}
|
||||
|
||||
function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPageProps) {
|
||||
function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
@@ -172,10 +171,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("보완완료 처리되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${docNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", docNo],
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("보완완료 실패:", error);
|
||||
alert("보완완료 처리 중 오류가 발생했습니다.");
|
||||
@@ -194,11 +190,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}/edit`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -227,12 +219,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
if (id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
|
||||
@@ -22,8 +22,8 @@ import {
|
||||
import { instlSncnService } from "@/entities/instl-sncn";
|
||||
import {
|
||||
type SewerBscPlanApplySaveRequestDto,
|
||||
sewerBscPlanBaseKey,
|
||||
type SewerBscPlanDetResponseDto,
|
||||
sewerBscPlanKeys,
|
||||
sewerBscPlanService,
|
||||
} from "@/entities/sewer-bsc-plan";
|
||||
import { SplmntDmndDialog, type SplmntDmndDialogConfirmPayload } from "@/widgets/pbadms-sprt";
|
||||
@@ -127,13 +127,6 @@ function FloatingActionButtons({
|
||||
return actionButtons.some((button) => button === action);
|
||||
}
|
||||
|
||||
async function invalidateDetail() {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findDetails", sewerBscPlanDocNo, chgCycl],
|
||||
});
|
||||
await queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
}
|
||||
|
||||
async function executeAction({
|
||||
action,
|
||||
request,
|
||||
@@ -156,7 +149,7 @@ function FloatingActionButtons({
|
||||
queryClient,
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
void invalidateDetail();
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
},
|
||||
onError: (error) => {
|
||||
let errorMessage = "";
|
||||
@@ -428,7 +421,7 @@ function FloatingActionButtons({
|
||||
elaprDocNo={docNo}
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
void invalidateDetail();
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
@@ -506,7 +499,7 @@ async function handleDmndSplmnt(
|
||||
context.chgCycl,
|
||||
context.request,
|
||||
);
|
||||
await context.queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
await context.queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
context.router.replace(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}?chgCycl=${result.chgCycl}`);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
|
||||
@@ -13,8 +13,8 @@ import { useAcntgSeMngTree } from "@/entities/acntg";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import {
|
||||
SewerBscPlanApplySaveResponseDto,
|
||||
sewerBscPlanBaseKey,
|
||||
type SewerBscPlanDetResponseDto,
|
||||
sewerBscPlanKeys,
|
||||
sewerBscPlanService,
|
||||
} from "@/entities/sewer-bsc-plan";
|
||||
import {
|
||||
@@ -123,11 +123,7 @@ function SewerBscPlanFormPage({
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}/edit?chgCycl=${result.chgCycl}`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findDetails", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -166,7 +162,7 @@ function SewerBscPlanFormPage({
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}?chgCycl=${result.chgCycl ?? 1}`);
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
@@ -203,7 +199,7 @@ function SewerBscPlanFormPage({
|
||||
alert("보완완료 처리되었습니다.");
|
||||
const chgCycl = data.sewerBscPlanDtl.chgCycl ?? initialData?.detDto?.chgCycl ?? 1;
|
||||
router.push(`/sewer-bsc-plan/${docNo}?chgCycl=${chgCycl}`);
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("보완완료 실패:", error);
|
||||
alert("보완완료 처리 중 오류가 발생했습니다.");
|
||||
@@ -232,7 +228,7 @@ function SewerBscPlanFormPage({
|
||||
await sewerBscPlanService.delete(docNo);
|
||||
alert("삭제되었습니다.");
|
||||
router.push("/sewer-bsc-plan");
|
||||
queryClient.invalidateQueries({ queryKey: [...sewerBscPlanBaseKey, "findPage"] });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.list() });
|
||||
} catch (error) {
|
||||
console.error("삭제 실패:", error);
|
||||
alert("삭제 중 오류가 발생했습니다.");
|
||||
|
||||
Reference in New Issue
Block a user