feat: tambah dependensi 'jose' versi 5.9.2 pada package.json
refactor: rapikan identasi dan buat field 'expires' opsional di model UserSession pada schema prisma chore: bersihkan import tidak terpakai di route login dan register API
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import { cookies } from "next/headers";
|
||||
import { unsealData } from "iron-session";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { ServerEnv } from "@/app/lib/server_env";
|
||||
import { unsealData } from "iron-session";
|
||||
import _ from "lodash";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
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("ssn");
|
||||
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value))
|
||||
return redirect(RouterAuth.login);
|
||||
|
||||
export async function user_funGetOneUserId() {
|
||||
const kukis = cookies();
|
||||
const c = kukis.get("ssn");
|
||||
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value))
|
||||
return redirect(RouterAuth.login);
|
||||
const token = JSON.parse(
|
||||
await unsealData(c?.value as string, {
|
||||
password: ServerEnv.value?.WIBU_PWD as string,
|
||||
})
|
||||
);
|
||||
|
||||
const token = JSON.parse(
|
||||
await unsealData(c?.value as string, {
|
||||
password: PwdCookies,
|
||||
})
|
||||
);
|
||||
|
||||
return token.id;
|
||||
return token.id;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user