add custom matches
This commit is contained in:
13
src/routes/api/notifications/+server.ts
Normal file
13
src/routes/api/notifications/+server.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import { getNotifications } from '$lib/server/notifications';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
export const GET: RequestHandler = async ({ locals, url }) => {
|
||||
if (!locals.user) error(401, 'Not logged in');
|
||||
|
||||
const limit = parseInt(url.searchParams.get('limit') ?? '50');
|
||||
const offset = parseInt(url.searchParams.get('offset') ?? '0');
|
||||
|
||||
const notifications = await getNotifications(locals.user.id, { limit, offset });
|
||||
return json(notifications);
|
||||
};
|
||||
Reference in New Issue
Block a user