From 41cb9c495c0bd524026ac4c2b126dbb479230e4c Mon Sep 17 00:00:00 2001 From: DanilsGit Date: Wed, 11 Jun 2025 11:40:32 -0500 Subject: [PATCH] fixing images in profile and add aside room --- app/(auth)/login/_lib/_actions/session.ts | 13 +++++ app/(protected)/dashboard/_apis/messages.ts | 1 + app/_components/AsideDashboard.tsx | 10 ++-- app/_components/AsideRoom.tsx | 59 ++++++++++++++++++++- middleware.ts | 10 ++++ 5 files changed, 85 insertions(+), 8 deletions(-) diff --git a/app/(auth)/login/_lib/_actions/session.ts b/app/(auth)/login/_lib/_actions/session.ts index 51af558..ba84e6d 100644 --- a/app/(auth)/login/_lib/_actions/session.ts +++ b/app/(auth)/login/_lib/_actions/session.ts @@ -12,6 +12,19 @@ export async function createSession(token: string) { }); } +export async function createPendingPath(path: string) { + (await cookies()).set('pendingPath', path, { + httpOnly: true, + secure: process.env.NODE_ENV === 'production', + sameSite: 'lax', + maxAge: 60 * 60 * 24 * 1, // 1 dia + }); +} + +export async function deletePendingPath() { + (await cookies()).delete('pendingPath'); +} + export async function deleteSession() { (await cookies()).delete('session'); } diff --git a/app/(protected)/dashboard/_apis/messages.ts b/app/(protected)/dashboard/_apis/messages.ts index d09aac7..188eef5 100644 --- a/app/(protected)/dashboard/_apis/messages.ts +++ b/app/(protected)/dashboard/_apis/messages.ts @@ -5,6 +5,7 @@ import { IMessage } from '@/app/_lib/_interfaces/IMessage'; export const getRoomMessages = async (roomId: string) => { try { const res = await myAxios.get(`/api/v1/chat/rooms/${roomId}/messages`); + console.log('Fetched room messages:', res.data); return res.data; } catch (error) { console.error('Error fetching room messages:', error); diff --git a/app/_components/AsideDashboard.tsx b/app/_components/AsideDashboard.tsx index d359afc..dbb8879 100644 --- a/app/_components/AsideDashboard.tsx +++ b/app/_components/AsideDashboard.tsx @@ -47,17 +47,15 @@ export default function AsideDashboard() {
-
- + {/* image of user -
-

{user?.displayName}

-
+ /> */} +

{user?.displayName}