finishing auth controller verification
This commit is contained in:
10
src/middleware/auth.middleware.ts
Normal file
10
src/middleware/auth.middleware.ts
Normal 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";
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user