make it a server component

This commit is contained in:
andrzej 2024-09-13 21:53:27 +02:00
parent 8dc7d08210
commit 1d13d79682
1 changed files with 3 additions and 2 deletions

View File

@ -1,9 +1,10 @@
"use server"
import prisma from 'app/lib/db'; import prisma from 'app/lib/db';
import { jwtVerify, JWTPayload, decodeJwt } from 'jose'; import { jwtVerify, JWTPayload, decodeJwt } from 'jose';
import { cookies } from 'next/headers'; import { cookies } from 'next/headers';
export function getJWTSecretKey() { export async function getJWTSecretKey() {
const secret = process.env.JWT_SECRET const secret = process.env.JWT_SECRET
if (!secret) throw new Error("There is no JWT secret key") if (!secret) throw new Error("There is no JWT secret key")
return new TextEncoder().encode(secret) return new TextEncoder().encode(secret)
@ -64,7 +65,7 @@ export async function logout() {
return null return null
} }
export function setUserDataCookie(userData) { export async function setUserDataCookie(userData) {
const cookieStore = cookies(); const cookieStore = cookies();
cookieStore.set({ cookieStore.set({
name: 'userData', name: 'userData',