initial deployment v1.0
This commit is contained in:
14
src/routes/api/admin/dismiss-report/+server.js
Normal file
14
src/routes/api/admin/dismiss-report/+server.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import { resolveReport } from '$lib/server/db.js';
|
||||
import { verifySession, SESSION_COOKIE } from '$lib/server/session.js';
|
||||
|
||||
export async function POST({ request, cookies }) {
|
||||
const session = verifySession(cookies.get(SESSION_COOKIE));
|
||||
if (!session) throw error(401, 'Unauthorized');
|
||||
|
||||
const { id } = await request.json().catch(() => ({}));
|
||||
if (!id) throw error(400, 'Missing report id');
|
||||
|
||||
resolveReport(id, 1);
|
||||
return json({ success: true });
|
||||
}
|
||||
Reference in New Issue
Block a user