import { USER_AGENT } from "./config"; export const HEADERS = { "User-Agent": USER_AGENT, "Content-Type": "application/json; charset=UTF-8", }; export const fetchDataViaGet = async (url) => { try { const response = await fetch(url, { headers: HEADERS, }); const data = await response.json(); return data; } catch (error) { console.log(error); } }; export const fetchDataViaPost = async (url, body) => { try { const response = await fetch(url, { method: "POST", headers: HEADERS, body: JSON.stringify(body), }); const data = await response.json(); return data; } catch (error) { console.log(error); } };