빗물재이용 데이터 조회 개발 중

This commit is contained in:
leedj312
2025-03-24 14:42:07 +09:00
parent 8d904d6714
commit 27ea503260
12 changed files with 430 additions and 140 deletions
+64
View File
@@ -0,0 +1,64 @@
//8880
import { DEV_URL_WR } from "../config/env";
export const getFectch = async (url: string) => {
const response = await fetch( DEV_URL_WR+url , {
method: "GET",
headers: {
accept: "application/json",
},
});
if(!response.ok) {
throw new Error(`오류 발생: ${response.status}`);
}
const res = await response.json()
return res.data;
}
export const postFectch = async (url: string, params: any) => {
const response = await fetch(DEV_URL_WR+url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
if(!response.ok) {
throw new Error(`오류 발생: ${response.status}`);
}
return response;
}
export const putFectch = async (url: string, params: any) => {
const response = await fetch(DEV_URL_WR+url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
if(!response.ok) {
throw new Error(`오류 발생: ${response.status}`);
}
return response;
}
export const deleteFectch = async (url: string, params: any) => {
const response = await fetch(DEV_URL_WR+url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(params),
});
if(!response.ok) {
throw new Error(`오류 발생: ${response.status}`);
}
return response;
}