import { AUTOSHIP } from '@/config/url-prefix'
import { uuidv4 } from '@/helpers/hash'
export default {
  name: 'autoship',
  type: 'path',
  match: [AUTOSHIP],
  inAppArea: async function(app) {
    let identity = app.$store.getters.getUserIdentifier

    if (identity.trim() === '') {
      identity = uuidv4()
    }
    return app.$store.dispatch('setUserIdentifier', { type: 'autoship', value: identity })
  },
  outAppArea: function(app) {
    return app.$store.dispatch('clearUserIdentifier')
  },
}
