fix(nuxt3): don't mutate options when unsetting cookie (#2481)

This commit is contained in:
Daniel Roe 2021-12-21 12:02:55 +00:00 committed by GitHub
parent b5618e976b
commit 670a12caaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,7 @@ function readRawCookies (opts: CookieOptions = {}): Record<string, string> {
function serializeCookie (name: string, value: any, opts: CookieSerializeOptions = {}) {
if (value === null || value === undefined) {
opts.maxAge = -1
return serialize(name, value, { ...opts, maxAge: -1 })
}
return serialize(name, value, opts)
}