atom-nextjs
Version:
Build a blog in NextJS using components, TailwindCSS, and Atom CMS.
18 lines (14 loc) • 414 B
text/typescript
import { ApiResponse, Post } from '../types';
import { baseAPIRoute } from '../constants';
export const getPost = async (projectKey: string, postId: string) => {
const res = await fetch(
`${baseAPIRoute}/posts/get/single?post_id=${postId}`,
{
headers: {
Authorization: `Bearer ${projectKey}`,
},
}
);
const data = (await res.json()) as ApiResponse<Post>;
return data;
};