Skip to content

Commit

Permalink
fix: Fix user local settings cookie to have max age as by default it'…
Browse files Browse the repository at this point in the history
…s a session cookie. Fix #104
  • Loading branch information
MohamedBassem committed Apr 16, 2024
1 parent 4629dac commit bb44ebc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/web/lib/userLocalSettings/userLocalSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {
export async function updateBookmarksLayout(layout: BookmarksLayoutTypes) {
const userSettings = cookies().get(USER_LOCAL_SETTINGS_COOKIE_NAME);
const parsed = parseUserLocalSettings(userSettings?.value);
cookies().set(
USER_LOCAL_SETTINGS_COOKIE_NAME,
JSON.stringify({ ...parsed, bookmarkGridLayout: layout }),
);
cookies().set({
name: USER_LOCAL_SETTINGS_COOKIE_NAME,
value: JSON.stringify({ ...parsed, bookmarkGridLayout: layout }),
maxAge: 34560000, // Chrome caps max age to 400 days
sameSite: "lax",
});
}

0 comments on commit bb44ebc

Please sign in to comment.