mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-19 15:10:58 +00:00
fix(nuxt): add undefined
type for useCookie
return value
This commit is contained in:
parent
b068f79fee
commit
4f0b3c7223
@ -27,7 +27,7 @@ const CookieDefaults: CookieOptions<any> = {
|
|||||||
encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val))
|
encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useCookie <T = string | null> (name: string, _opts?: CookieOptions<T>): CookieRef<T> {
|
export function useCookie <T = string | null | undefined> (name: string, _opts?: CookieOptions<T>): CookieRef<T> {
|
||||||
const opts = { ...CookieDefaults, ..._opts }
|
const opts = { ...CookieDefaults, ..._opts }
|
||||||
const cookies = readRawCookies(opts) || {}
|
const cookies = readRawCookies(opts) || {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user