봉인fetch (get과post)

	import qs from "querystring"
	
	export async function getData(url) {
	    const result =await fetch(url);
	    const data=await result.json();
	    return data;
	}
	
	export async function postData(url,data) {
	    const result =await fetch(url, {
	        method: "post",
	        headers: {
	            'Accept': 'application/json, text/plain, */*',
	            'Content-Type': 'application/x-www-form-urlencoded'
	        },
	        body:qs.stringify(data)
	    })
	    
	    const data=await result.json();
	    return data;
	}

좋은 웹페이지 즐겨찾기