[apps/cs] feat: 팝업 삭제 기능 추가 (CS_UT02040105)

This commit is contained in:
2025-07-10 11:27:12 +09:00
parent cc21f5a044
commit ea0790d1c7
5 changed files with 20 additions and 3 deletions
@@ -41,6 +41,10 @@ export class PopupApiService implements PopupService {
validatedData,
);
}
public async deletePopup(popupSn: number): Promise<void> {
await client.delete(`${ENDPOINT.CMS_SERVICE.POPUPS}/${popupSn}`);
}
}
export const PopupApi = new PopupApiService();
@@ -68,4 +68,5 @@ export interface PopupService {
getPopupInfo(popupSn: number): Promise<PopupInfo>;
createPopup(data: PopupFormData): Promise<void>;
updatePopup(popupSn: number, data: PopupUpdateFormData): Promise<void>;
deletePopup(popupSn: number): Promise<void>;
}
+13 -1
View File
@@ -52,6 +52,13 @@ function ModifyPage({ popupSn }: { popupSn: number }) {
},
});
const { mutateAsync: deletePopup } = useMutationWrapper({
mutationFn: () => PopupApi.deletePopup(popupSn),
onSuccess: () => {
alert("삭제되었습니다.", router.back);
},
});
const { mutateAsync: savePostingHistory } = useMutationWrapper({
mutationFn: (data: PostPayload[]) => PostingApi.savePosting(data),
onSuccess: () => {
@@ -101,7 +108,12 @@ function ModifyPage({ popupSn }: { popupSn: number }) {
<div className="card-header">
<h3 className="text-2xl font-medium text-label">팝업 수정</h3>
</div>
<PopupForm form={form} handleSave={updatePopup} />
<PopupForm
form={form}
popupSn={popupSn}
handleSave={updatePopup}
handleDelete={deletePopup}
/>
</div>
<div className="card card-border">
<div className="card-header">
+1 -1
View File
@@ -32,7 +32,7 @@ const Editor = dynamic(
type PopupFormProps<T extends PopupFormData | PopupUpdateFormData> = {
form: UseFormReturn<T>;
popupSn?: string;
popupSn?: number;
handleSave: (data: T) => Promise<void>;
handleDelete?: () => Promise<void>;
};
@@ -102,7 +102,7 @@ function GeneralFileUploader<T extends { atflCd?: string | null }>({
<span>{attachment.orgnlFileNm}</span>
<Button
color="lightGray"
className="flex size-7 items-center justify-center rounded-full p-0"
className="flex size-7 shrink-0 items-center justify-center rounded-full p-0"
onClick={() =>
setDeleteAttachmentIds([...deleteAttachmentIds, atflId])
}