mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: use cookie-es
This commit is contained in:
parent
0db1002a3b
commit
8994b5a368
@ -29,7 +29,7 @@
|
||||
"@vueuse/head": "^0.7.2",
|
||||
"acorn": "^8.6.0",
|
||||
"consola": "^2.15.3",
|
||||
"cookie": "^0.4.1",
|
||||
"cookie-es": "^0.5.0",
|
||||
"defu": "^5.0.0",
|
||||
"destr": "^1.1.0",
|
||||
"enhanced-resolve": "^5.8.3",
|
||||
|
@ -31,7 +31,7 @@
|
||||
"@vueuse/head": "^0.7.2",
|
||||
"chokidar": "^3.5.2",
|
||||
"consola": "^2.15.3",
|
||||
"cookie": "^0.4.1",
|
||||
"cookie-es": "^0.5.0",
|
||||
"defu": "^5.0.0",
|
||||
"destr": "^1.1.0",
|
||||
"globby": "^11.0.4",
|
||||
|
@ -1,7 +1,6 @@
|
||||
import type { ServerResponse } from 'http'
|
||||
import { Ref, ref, watch } from 'vue'
|
||||
import type { CookieParseOptions, CookieSerializeOptions } from 'cookie'
|
||||
import * as cookie from 'cookie'
|
||||
import { parse, serialize, CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
|
||||
import { appendHeader } from 'h3'
|
||||
import type { NuxtApp } from '@nuxt/schema'
|
||||
import destr from 'destr'
|
||||
@ -50,9 +49,9 @@ function useSSRRes (nuxtApp?: NuxtApp = useNuxtApp()) { return nuxtApp.ssrContex
|
||||
|
||||
function readRawCookies (opts: CookieOptions = {}): Record<string, string> {
|
||||
if (process.server) {
|
||||
return cookie.parse(useSSRReq().headers.cookie || '', opts)
|
||||
return parse(useSSRReq().headers.cookie || '', opts)
|
||||
} else if (process.client) {
|
||||
return cookie.parse(document.cookie, opts)
|
||||
return parse(document.cookie, opts)
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +59,7 @@ function serializeCookie (name: string, value: any, opts: CookieSerializeOptions
|
||||
if (value === null || value === undefined) {
|
||||
opts.maxAge = -1
|
||||
}
|
||||
return cookie.serialize(name, value, opts)
|
||||
return serialize(name, value, opts)
|
||||
}
|
||||
|
||||
function writeClientCookie (name: string, value: any, opts: CookieSerializeOptions = {}) {
|
||||
|
11
yarn.lock
11
yarn.lock
@ -2436,7 +2436,7 @@ __metadata:
|
||||
"@vueuse/head": ^0.7.2
|
||||
acorn: ^8.6.0
|
||||
consola: ^2.15.3
|
||||
cookie: ^0.4.1
|
||||
cookie-es: ^0.5.0
|
||||
defu: ^5.0.0
|
||||
destr: ^1.1.0
|
||||
enhanced-resolve: ^5.8.3
|
||||
@ -7912,6 +7912,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"cookie-es@npm:^0.5.0":
|
||||
version: 0.5.0
|
||||
resolution: "cookie-es@npm:0.5.0"
|
||||
checksum: afe924dd44e2c9aaa60ed77e78182e44324acd0a155ea947bb0174e5c48625ee277b004bfbca1bc6cfd24955f2b4039813c7c88bd9d7921ca475eae0286d2666
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"cookie@npm:^0.3.1":
|
||||
version: 0.3.1
|
||||
resolution: "cookie@npm:0.3.1"
|
||||
@ -15295,7 +15302,7 @@ __metadata:
|
||||
"@vueuse/head": ^0.7.2
|
||||
chokidar: ^3.5.2
|
||||
consola: ^2.15.3
|
||||
cookie: ^0.4.1
|
||||
cookie-es: ^0.5.0
|
||||
defu: ^5.0.0
|
||||
destr: ^1.1.0
|
||||
globby: ^11.0.4
|
||||
|
Loading…
Reference in New Issue
Block a user