Open hasyrails opened 3 years ago
$ RAILS_ENV=production bundle exec rails assets:precompile
$ export RAILS_SERVE_STATIC_FILES=true
$ bundle exec rails s -e production
vue.runtime.esm.js:1927 TypeError: Cannot read property 'get' of undefined
at a.beforeCreate (app.vue:35)
beforeCreate(){
const existingSession = this.$cookies.get('session')
if (existingSession && existingSession.length) { // A string at this point
const session = JSON.parse(existingSession)
this.$store.commit('auth/signIn', session.user)
// this.$store.commit('auth', session.tokens)
}
},
How do I get Vue-Cookies to work in Vue-Router Component vue-cookies - npm
this.$cookies
↓
$cookies
Rails 5.2で Webpacker + Vue.jsを使ってSPAを実現 - Qiita