From c7fc9ac8ab56f93aa443f17e517ae185cdbd9b36 Mon Sep 17 00:00:00 2001 From: Adrien KISSIE Date: Sun, 14 Jan 2024 16:56:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20keep=20session=20and=20location?= =?UTF-8?q?=20in=20the=20same=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(app)/settings/sessions/page.tsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/app/(app)/settings/sessions/page.tsx b/src/app/(app)/settings/sessions/page.tsx index db9068ce..08e1ca93 100644 --- a/src/app/(app)/settings/sessions/page.tsx +++ b/src/app/(app)/settings/sessions/page.tsx @@ -96,16 +96,20 @@ export default async function SessionListPage() { async function AllSessions({ userId }: { userId: number }) { const [currentSesssion, userSessions] = await Promise.all([ getSession(), - Session.getUserSessions(userId) + Session.getUserSessions(userId).then((sessions) => + Promise.all( + sessions.map(async (session) => { + const location = await getLocationData(session); + return { session, location }; + }) + ) + ) ]); - const sessionLocationData = await Promise.all( - userSessions.map(getLocationData) - ); return (