fix ( middleware )

deskripsi:
- fix access api melalui middleware di: home, profile dan portofolio
This commit is contained in:
2025-01-08 10:39:18 +08:00
parent 18bd4efed1
commit cccb011da5
36 changed files with 1206 additions and 450 deletions

View File

@@ -1,6 +1,5 @@
"use server";
import { jwtVerify } from "jose";
import { cookies } from "next/headers";
import { decrypt } from "../../../../app/auth/_lib/decrypt";
@@ -16,21 +15,3 @@ export async function funGetUserIdByToken() {
return cekUser?.id;
}
// async function decrypt({
// token,
// encodedKey,
// }: {
// token: string;
// encodedKey: string;
// }): Promise<Record<string, any> | null> {
// try {
// const enc = new TextEncoder().encode(encodedKey);
// const { payload } = await jwtVerify(token, enc, {
// algorithms: ["HS256"],
// });
// return (payload.user as Record<string, any>) || null;
// } catch (error) {
// console.error("Gagal verifikasi session", error);
// return null;
// }
// }