Create login check middleware for all appeals api routes
This commit is contained in:
parent
732e9f0336
commit
cce71c9093
12
functions/api/appeals/_middleware.ts
Normal file
12
functions/api/appeals/_middleware.ts
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user