make it a server component
This commit is contained in:
parent
2b64b98d1d
commit
98f762d31e
|
@ -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',
|
||||||
|
|
Loading…
Reference in New Issue