WTF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! same iss

This commit is contained in:
Leon Serfaty G
2025-07-17 11:28:33 +00:00
parent 2cb510f038
commit 89cfc08a17
+7 -2
View File
@@ -1,3 +1,4 @@
'use server'; 'use server';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
@@ -54,14 +55,18 @@ export async function signOut() {
} }
export async function getSession() { export async function getSession() {
const sessionCookie = cookies().get('session'); const cookieStore = cookies();
const sessionCookie = cookieStore.get('session');
if (!sessionCookie) { if (!sessionCookie) {
return null; return null;
} }
try { try {
return JSON.parse(sessionCookie.value); const session = JSON.parse(sessionCookie.value);
return session;
} catch (error) { } catch (error) {
console.error('Failed to parse session cookie:', error); console.error('Failed to parse session cookie:', error);
return null; return null;
} }
} }