finishing auth controller verification

This commit is contained in:
rafiarrafif
2025-05-13 14:35:48 +07:00
parent ad9f66a642
commit 9cb84372b8
7 changed files with 78 additions and 28 deletions

View File

@ -0,0 +1,10 @@
import { Context } from "elysia";
export const authMiddleware = (ctx: Context) => {
const token = ctx.cookie.auth_token;
if (!token) {
ctx.set.status = 401;
throw "Unauthorized: Token missing";
}
};