|
|
@@ -22,7 +22,9 @@ export function hasSessionCookie(): boolean {
|
|
|
}
|
|
|
|
|
|
export function setSessionCookie(): void {
|
|
|
- document.cookie = `session=1; path=/; max-age=${SESSION_COOKIE_AGE}; SameSite=Lax`
|
|
|
+ const isSecure = typeof location !== 'undefined' && location.protocol === 'https:'
|
|
|
+ const sameSite = isSecure ? 'Strict' : 'Lax'
|
|
|
+ document.cookie = `session=1; path=/; max-age=${SESSION_COOKIE_AGE}; SameSite=${sameSite}${isSecure ? '; Secure' : ''}`
|
|
|
}
|
|
|
|
|
|
export function clearSessionCookie(): void {
|
|
|
@@ -106,6 +108,7 @@ async function request<T>(
|
|
|
throw new ApiRequestError(res.status, message, errBody)
|
|
|
}
|
|
|
|
|
|
+ if (res.status === 204) return undefined as T
|
|
|
return res.json()
|
|
|
}
|
|
|
|