From 5f0815bc3cc12982a177290f48f92a9bf10706b3 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 10 Apr 2024 00:29:03 -0400 Subject: [PATCH] Add cookie expiration --- src/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 924092962..714cc5b08 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -215,7 +215,9 @@ export const serverUrl = isLocal ? 'http://localhost:8001' : ''; export const apiUrl = isLocal ? serverUrl : 'api'; export function setCookie(cName: string, cValue: string): void { - document.cookie = `${cName}=${cValue};SameSite=Strict;path=/`; + const expiration = new Date(); + expiration.setTime(new Date().getTime() + 3600000 * 24 * 7); + document.cookie = `${cName}=${cValue};SameSite=Strict;path=/;expires=${expiration.toUTCString()}`; } export function getCookie(cName: string): string {