Closed StrangeTown closed 7 years ago
It was my fault, I just used it as "Vue.cookie(name, value)".
The right way to use it is Vue.cookie.set(name, value)
@StrangeTown I'm also looking to get this to work within my STORE. Do I just import it within /store/index.js
file?
import Vue from 'vue'
import axios from 'axios'
import Vuex from 'vuex'
import cookie from 'vue-cookie'
I have something like:
mutations: {
setCookie(value) {
Vue.cookie.set('lang', value)
}
},
actions: {
async nuxtServerInit({ state, commit }, { isDev }) {
if (Vue.cookie.get() == null) {
console.log('No cookies. Let\'s set one up');
commit('setCookie', state.apiURI)
}
I get error: document is not defined
I want to set a cookie in vuex's mutations.js file,
but when I use 'Vue.cookie' directly, there was an error occurred: