From a40665bd6c0ec8cbb64eef0f3d7d516ea7ebc812 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:13 -0400 Subject: [PATCH] Create self-resource middleware --- functions/api/me/_middleware.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 functions/api/me/_middleware.ts diff --git a/functions/api/me/_middleware.ts b/functions/api/me/_middleware.ts new file mode 100644 index 0000000..e05b5bf --- /dev/null +++ b/functions/api/me/_middleware.ts @@ -0,0 +1,7 @@ +import { jsonError } from "../../common.js"; + +export async function onRequest(context: RequestContext) { + if (!context.data.current_user) return jsonError("Not logged in", 401); + + return await context.next(); +}