import { API_ENDPOINT } from "./endpointDef"; import apiEndpoints from "./apiEndpoints"; export const postsApi = async (jwt) => { const result = await fetch(`${API_ENDPOINT}${apiEndpoints.fetchPosts}`, { method: "GET", headers: { "Content-Type": "application/json", 'Authorization': "Bearer " + jwt, }, }); const res = await result.json(); return res; }; export const singlePostApi = async (jwt, postId) => { const result = await fetch(`${API_ENDPOINT}api/posts/${postId}?populate=*`, { method: "GET", headers: { "Content-Type": "application/json", 'Authorization': "Bearer " + jwt, }, }); const res = await result.json(); return res; };