vue-cookie-next
vue-cookie-next copied to clipboard
removeCookie doesn't work in composition API
There is no this inside the removeCookie method when using the composition API (it is used to call isCookieAvailable).
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")