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 (playerIdCookie) {
return NextResponse.redirect(
new URL(`/player/${playerIdCookie}`, request.url),
new URL(`/player/${playerIdCookie.value}`, request.url),
);
} else {
return NextResponse.redirect(new URL("/search", request.url));

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