Removed unused file posts.ts (#249)

This commit is contained in:
he1d1 authored and GitHub committed 2022-06-23 00:48:15 -07:00
1 parent c9ee31c064
commit 020ee02a7f
1 file changed
-41
-41
View File
@@ -1,41 +0,0 @@
import GhostContentAPI from '@tryghost/content-api';
// Ghost key is a public key
const ghostKey = import.meta.env.VITE_CONTENT_API_KEY;
const ghostURL = import.meta.env.VITE_API_URL;
export const blogEnabled = ghostURL && ghostKey;
export const api = blogEnabled
? new GhostContentAPI({
url: ghostURL,
key: ghostKey,
version: 'v4'
})
: null;
export async function getPosts() {
if (!api) {
return [];
}
const posts = await api.posts
.browse({
include: ['tags', 'authors']
})
.catch(() => []);
return posts;
}
export async function getPost(slug: string) {
if (!api) {
return null;
}
return await api.posts
.read(
{ slug },
{
include: ['tags', 'authors']
}
)
.catch(() => null);
}