From b05c50df1e6baa48ee0360612c94aadfe0d77d99 Mon Sep 17 00:00:00 2001 From: Giovanni Martire Date: Mon, 1 Apr 2024 19:56:38 +0200 Subject: [PATCH] create gamemode cookie on login --- app/actions.ts | 8 ++++++++ app/dashboard/page.tsx | 1 + 2 files changed, 9 insertions(+) diff --git a/app/actions.ts b/app/actions.ts index b93341b..8feca03 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -84,6 +84,14 @@ export async function login(cookie: { session.scopes = loggedUser.scopes; session.isLogged = true; + await cookies().set('OTR-user-selected-osu-mode', loggedUser.osuPlayMode, { + httpOnly: true, + path: '/', + sameSite: 'strict', + secure: process.env.NODE_ENV === 'production', + maxAge: 1209600, + }); + await session.save(); /* await changeOsuModeCookie(res.osuPlayMode); */ diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index e59d41f..1b90040 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -31,6 +31,7 @@ export default async function page({ if (!data.generalStats || !data.playerInfo) { throw Error('4'); + return; } return (