vue-cookie icon indicating copy to clipboard operation
vue-cookie copied to clipboard

Vuex integration method

Open alexander-girsh opened this issue 6 years ago • 3 comments

Hi there, this plugin is comfy (thank you, mr. Alfhen) , but if you want to incapsulate smth in vuex store (for example the choice between cookie and local storage), you may have an issue: from-the-box vuex doesn't know about this.$cookie or vm.$cookie.

All u need is just reinitialize that. Look on the pictures. vuex store app call

alexander-girsh avatar Sep 16 '18 16:09 alexander-girsh

I had the same problem

MauricioHernanCabrera avatar Sep 18 '18 16:09 MauricioHernanCabrera

@noguilty4you @MauricioHernanCabrera Another option is to just use vue.prototype.$cookie directly.

import vue from 'vue'

async someAction ({ commit }) {
  // Do something
  vue.prototype.$cookie.set(key, value)
}

ezra-obiwale avatar Dec 12 '18 05:12 ezra-obiwale

@noguilty4you @MauricioHernanCabrera Another option is to just use vue.prototype.$cookie directly.

import vue from 'vue'

async someAction ({ commit }) {
  // Do something
  vue.prototype.$cookie.set(key, value)
}

thanks, vue.prototype is interesting syntax

alexander-girsh avatar Dec 12 '18 11:12 alexander-girsh