EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 282 forks source link

Vuex Setup #63

Closed Tes3awy closed 4 years ago

Tes3awy commented 4 years ago

Can you please provide me with some steps to start using Vuex? I didn't edit any file within the store directory. However; after the setup, I get this error Error in the created hook: "TypeError: Cannot read property 'get' of undefined" in the browser's console. This error is caused by the following two lines in the created life-cycle hook in the parent Vue instance.

new Vue({
  router,
  store,
  render: (h) => h(App),
  created() {
    this.$store.commit(types.RESET_LOADING_PROGRESS);
    this.$store.dispatch('getAllCategories'); // This one
    this.$store.dispatch('getAllPages'); // And this one as well
  }
}).$mount('#app');

Can you please guide me solve this problem? I am really grateful for this amazing work. Thank you so much.

EvanAgee commented 4 years ago

Hey @Tes3awy I'm guessing this error is actually being triggered in this file: https://github.com/EvanAgee/vuejs-wordpress-theme-starter/blob/master/src/api/index.js are you still importing axios?

Tes3awy commented 4 years ago

@EvanAgee Yes, I am still importing axios

Tes3awy commented 4 years ago

I figured out the problem. I didn't provide the correct path in settings.js file. I'll also add some instructions to the README.md file to help others.