import { createNuxtPersistedState } from 'pinia-plugin-persistedstate/nuxt'

export default defineNuxtPlugin(nuxtApp => {
  const maxAge = 365*24*60*60;
  const expires = new Date(Date.now() + 1000*maxAge);
  nuxtApp.$pinia.use(createNuxtPersistedState(useCookie, {
    cookieOptions: {
      expires, maxAge
    }
  }))
})