fix(nuxt3): use resolved options for useCookie (#2260)

This commit is contained in:
Daniel Roe 2021-12-02 11:29:26 +00:00 committed by GitHub
parent 1ef6e3f525
commit 6a25d3e245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ export function useCookie <T=string> (name: string, _opts?: CookieOptions<T>): C
const opts = { ...CookieDefaults, ..._opts }
const cookies = readRawCookies(opts)
const cookie = ref(cookies[name] ?? _opts.default?.())
const cookie = ref(cookies[name] ?? opts.default?.())
if (process.client) {
watch(cookie, () => { writeClientCookie(name, cookie.value, opts as CookieSerializeOptions) })