fix playerId cookie

This commit is contained in:
Lee 2023-10-24 09:51:49 +01:00
parent dc3d5b9b33
commit f9fbeebe75
2 changed files with 4 additions and 2 deletions

@ -9,7 +9,7 @@ export function middleware(request: NextRequest) {
if (pathname == "/") { if (pathname == "/") {
if (playerIdCookie) { if (playerIdCookie) {
return NextResponse.redirect( return NextResponse.redirect(
new URL(`/player/${playerIdCookie}`, request.url), new URL(`/player/${playerIdCookie.value}`, request.url),
); );
} else { } else {
return NextResponse.redirect(new URL("/search", request.url)); return NextResponse.redirect(new URL("/search", request.url));

@ -44,7 +44,9 @@ export const useSettingsStore = create<SettingsStore>()(
player: playerData, player: playerData,
}); });
cookieCutter.set("playerId", playerData.id); cookieCutter.set("playerId", playerData.id, {
path: "/",
});
}, },
async addFriend(friendId: string) { async addFriend(friendId: string) {