Create login check middleware for all appeals api routes

This commit is contained in:
regalijan 2023-10-19 16:49:12 -04:00
parent 732e9f0336
commit cce71c9093
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -0,0 +1,12 @@
export async function onRequest(context: RequestContext) {
if (!context.data.current_user)
return new Response('{"error":"Not logged in"}', {
headers: {
"content-type": "application/json",
},
status: 401,
});
return await context.next();
}