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,13 @@
import { parse } from "cookie";
import { Context } from "elysia";
import { AppError } from "../../../error/instances/app";
export const getCookie = (ctx: Context) => {
try {
const cookiePayload = ctx.request.headers.get("Cookie");
const cookies = parse(cookiePayload!);
return cookies;
} catch (error) {
throw new AppError(401, "Cookie not found");
}
};