fix(nuxt): use event.node.req in cookie utility (#20474)

This commit is contained in:
Andrew Luca 2023-04-24 23:25:36 +03:00 committed by GitHub
parent fd281f2d7d
commit ea1c5b2550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,7 @@ export function useCookie <T = string | null | undefined> (name: string, _opts?:
function readRawCookies (opts: CookieOptions = {}): Record<string, string> | undefined { function readRawCookies (opts: CookieOptions = {}): Record<string, string> | undefined {
if (process.server) { if (process.server) {
return parse(useRequestEvent()?.req.headers.cookie || '', opts) return parse(useRequestEvent()?.node.req.headers.cookie || '', opts)
} else if (process.client) { } else if (process.client) {
return parse(document.cookie, opts) return parse(document.cookie, opts)
} }