title: auto
des: auto note:auto
This commit is contained in:
16
src/app_modules/home/fun/get-token.ts
Normal file
16
src/app_modules/home/fun/get-token.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { getConfig } from "@/bin/config";
|
||||
import { unsealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function getToken() {
|
||||
const c = cookies().get("ssn");
|
||||
|
||||
const token = await unsealData(c?.value as string, {
|
||||
password: (await getConfig()).server.password,
|
||||
});
|
||||
|
||||
return token
|
||||
}
|
||||
Reference in New Issue
Block a user