Files
frontend/apps/sn/src/features/windowPopup/ui/FloodPreUploadPopupContent.tsx
T

43 lines
1.2 KiB
TypeScript

"use client";
import { postData } from "@/components/lib/api";
import OperFileUploadForm from "@/components/ui/operFileUploadForm";
import { tokenManager } from "@/entities/auth/lib/token-manager";
import { AUTH_USER_ID } from "@/shared/config";
import { postPopupMessageAndClose } from "../lib/popupMessage";
import { windowPopupDefinitions } from "../model/popupDefinitions";
import { WINDOW_POPUP_MESSAGE_TYPE } from "../model/types";
export default function FloodPreUploadPopupContent() {
const handleSubmit = async (
fileNm: string,
year: string,
quater: string,
cd: string,
id: string,
) => {
const data = await postData("v1/sbmrgPrevnt", {
mngYr: year,
mngQu: quater,
atflId: id,
atflCd: cd,
rgtr: tokenManager.getToken(AUTH_USER_ID) || null,
sbmrgPrevntBizNm: fileNm,
});
if (data) {
alert("파일이 등록되었습니다.");
postPopupMessageAndClose(WINDOW_POPUP_MESSAGE_TYPE.FLOOD_PRE_UPLOAD_COMPLETED);
}
};
return (
<div className="min-h-dvh bg-white p-4">
<OperFileUploadForm
title={windowPopupDefinitions.floodPreUpload.title}
onSubmit={handleSubmit}
/>
</div>
);
}