vue-cookie-next icon indicating copy to clipboard operation
vue-cookie-next copied to clipboard

removeCookie doesn't work in composition API

Open greendrake opened this issue 3 years ago • 1 comments

There is no this inside the removeCookie method when using the composition API (it is used to call isCookieAvailable).

greendrake avatar May 02 '22 14:05 greendrake

for others who may face this issue, here's a (ugly) workaround

import { useCookie } from 'vue-cookie-next'
const { removeCookie, isCookieAvailable } = useCookie()
...
// removeCookie("USER_ID") TypeError: Cannot read properties of undefined (reading 'isCookieAvailable')
removeCookie.bind({ isCookieAvailable: isCookieAvailable})("USER_ID")

JCCorreale avatar Feb 21 '24 23:02 JCCorreale