mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-29 16:04:38 -04:00
19 lines
668 B
TypeScript
19 lines
668 B
TypeScript
import { getPostReactions } from '~~/server/blog.ts';
|
|
import { getLocale, loadConfig } from '~~/server/data.ts';
|
|
import useAuthentication from '~~/server/utils/useAuthentication.ts';
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const config = await loadConfig(getLocale(event));
|
|
if (!config.links.enabled || !config.links.blog) {
|
|
throw createError({
|
|
status: 404,
|
|
statusMessage: 'Not Found',
|
|
});
|
|
}
|
|
|
|
const db = useDatabase();
|
|
const { user } = await useAuthentication(event);
|
|
const slug = getRouterParam(event, 'slug')!;
|
|
return await getPostReactions(db, getLocale(event), slug, user?.id);
|
|
});
|