import { Plugin } from '@nuxt/types'
import DataPersister from '~/services/data/dataPersister'

const dataPersisterPlugin: Plugin = (ctx) => {
  const dataPersister = new DataPersister()
  dataPersister.initCtx(ctx)

  // Déclare un nouvel accesseur de service via le context Nuxt
  ctx.$dataPersister = dataPersister
}

export default dataPersisterPlugin
