soc221b/pinia-plugin-persistedstate-2

ASK - how to implement using vue vite without nuxt on cookies storage?

syukriyansyah-ipb opened this issue · 1 comments

ASK - how to implement using vue vite without nuxt on cookies storage?

It's similar to https://github.com/iendeavor/pinia-plugin-persistedstate-2/tree/main/examples/nuxt-bridge-example:

import cookie from 'js-cookie'

const persistedStatePlugin = createPersistedStatePlugin({
  storage: {
    getItem: async (key) => {
      return cookie.get(key)
    },
    setItem: async (key, value) => {
      cookie.set(key, value)
    },
    removeItem: async (key) => {
      return cookie.remove(key)
    },
  },
})

// ...

https://github.com/iendeavor/pinia-plugin-persistedstate-2#storage