refactor:
- any 타입 지정 - postMutiPart 함수 정리
This commit is contained in:
@@ -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]);
|
||||
};
|
||||
|
||||
|
||||
@@ -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> => {
|
||||
|
||||
Reference in New Issue
Block a user