Fix: Cookies

This commit is contained in:
2024-11-26 01:06:46 +08:00
parent ac5b8a8c4b
commit 038c40a6fb
29 changed files with 341 additions and 172 deletions

View File

@@ -5,14 +5,14 @@ import { ServerEnv } from "@/app/lib/server_env";
import { unsealData } from "iron-session";
import _ from "lodash";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
export async function user_funGetOneUserId(): Promise<string | null> {
try {
const kukis = cookies();
const c = kukis.get("mySession");
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value))
return redirect(RouterAuth.login);
// if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value))
// return re-di-re-ct(RouterAuth.login);
const token = JSON.parse(
await unsealData(c?.value as string, {