Skip to content

Commit

Permalink
fix: Remove unnecessary cookie setting in removeCookie function
Browse files Browse the repository at this point in the history
  • Loading branch information
f-fsantos committed Jul 22, 2024
1 parent 04819b8 commit b42fa55
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export function setCookie(cName: string, cValue: string): void {

export function removeCookie(cName: string): void {
document.cookie = `${cName}=;Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=Thu, 01 Jan 1970 00:00:00 GMT`;
document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Expires=Thu, 01 Jan 1970 00:00:00 GMT`;

This comment has been minimized.

Copy link
@flx-sta

flx-sta Jul 22, 2024

Collaborator
 document.cookie = `${cName}=;Secure;SameSite=Strict;Path=/;Max-Age=-1`;

using max-age instead of expires is officially endorsed by MDN and other.
Reason is that the cookie doesn't have to deal with the time-zone issue that way.

}

export function getCookie(cName: string): string {
Expand Down

0 comments on commit b42fa55

Please sign in to comment.