[Vuejs]-Vue.js. TypeError: Cannot read property 'post' of undefined even though vue-resource is definitely installed

0👍

Ok, so I solved it.

The issue was I don’t know where. I had to basically import Vue and VueResource again, and tell Vue to use the package (again).

import Vue from 'vue'
import VueResource from 'vue-resource';
import App from './App.vue'

`Vue.use(VueResource);`

Please note I already tried doing it that way.

In App.vue, I have

submit() {
      this.$http
        .post("https://vue-http-20bf2.firebaseio.com/data.json", this.user)
        .then(
          response => {
            console.log(response);
          },
          error => {
            console.log(error);
          }
        );
    }

Leave a comment