refactor:

- any 타입 지정
- postMutiPart 함수 정리
This commit is contained in:
swcho
2025-08-25 13:47:50 +09:00
parent 5aec4b957c
commit c53a768c94
2 changed files with 3 additions and 9 deletions
@@ -54,7 +54,7 @@ const IrSetting = () => {
const [swtrmtFcltNm, setSwtrmtFcltNm] = useState<string>(''); // 하수처리시설명 상태
const [file, setFile] = useState(null);
const handleFileChange = (e) => {
const handleFileChange = (e: any) => {
setFile(e.target.files[0]);
};
+2 -8
View File
@@ -3,7 +3,7 @@ import axios from 'axios';
const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || '';
export const getData = async (url: string, data?: object): Promise<any> => {
export const getData = async (url: string): Promise<any> => {
const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, {
method: "GET",
});
@@ -49,14 +49,8 @@ export const postData = async (url: string, data: object): Promise<any> => {
};
export const postMutiPart = async (url: string, data: FormData): Promise<any> => {
const options: RequestInit = {
method: "POST",
body: data,
};
//const res = await fetch(`${BASE_URL}/${url}`, options);
const res = await axios.post(`${BASE_URL}/${url}`, data);
const resData = await res.json();
return resData;
return res.data;
};
export const putData = async (url: string, data: object): Promise<any> => {