PronounsPage/server/api/names/index.get.ts

12 lines
418 B
TypeScript

import { getLocale, loadConfig } from '~~/server/data.ts';
import { getNameEntries } from '~~/server/names.ts';
export default defineEventHandler(async (event) => {
const locale = getLocale(event);
checkIsConfigEnabledOr404(await loadConfig(locale), 'names');
const { isGranted } = await useAuthentication(event);
const db = useDatabase();
return await getNameEntries(db, isGranted, locale);
});