hasyrails / calendar-vue-original

0 stars 0 forks source link

本番環境が真っ白画面で表示される #368

Open hasyrails opened 3 years ago

hasyrails commented 3 years ago

Rails 5.2で Webpacker + Vue.jsを使ってSPAを実現 - Qiita

hasyrails commented 3 years ago
$ RAILS_ENV=production bundle exec rails assets:precompile
$ export RAILS_SERVE_STATIC_FILES=true
$ bundle exec rails s -e production
hasyrails commented 3 years ago

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)
    }
  },

this.$cookie がundefinedになる

How do I get Vue-Cookies to work in Vue-Router Component vue-cookies - npm

this.$cookies

$cookies