Skip to content

Commit

Permalink
refactor: change CookieSameSite to be an enum (#115)
Browse files Browse the repository at this point in the history
Co-authored-by: Kristján Oddsson <koddsson@gmail.com>
  • Loading branch information
2 people authored and markcellus committed Aug 18, 2022
1 parent 2215b54 commit f18a201
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function tryDecode(
}
}

type CookieSameSite = 'none' | 'lax' | 'strict';
type CookieMatchType = 'equals';

interface Cookie {
Expand Down Expand Up @@ -76,6 +75,12 @@ interface SerializeOptions {
sameSite?: boolean | string;
}

enum CookieSameSite {
strict = 'strict',
lax = 'lax',
none = 'none',
}

interface CookieInit {
name: string;
value: string;
Expand Down Expand Up @@ -325,7 +330,7 @@ class CookieStore extends EventTarget {
value: '',
path: '/',
secure: false,
sameSite: 'strict',
sameSite: CookieSameSite.strict,
};
if (typeof init === 'string') {
item.name = init as string;
Expand Down

0 comments on commit f18a201

Please sign in to comment.