question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to call Vue.http.post gives an error from vue-resource Client

See original GitHub issue

I’m trying to call an api using the following code

import Vue from 'vue';
export default {
  ready : () => {
   Vue.http.post('/my-api', {}).then((response) => {
       //success
    }, (response) => {
      //error
    });
  }
};

I recieve the following error inside my chrome dev console

TypeError: reqHandlers.pop(...).call is not a function(…)
error @ vue-resource.common.js?2f13:311
(anonymous function) @ vue-resource.common.js?2f13:1152

I tried using this.$http.post but I always the an error telling me that this is undefined

version : ^0.8.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danielschmitzcommented, Jun 17, 2016

try this:

export default {
  ready() {
   this.$http.post('/my-api', {}).then((response) => {
       //success
    }, (response) => {
      //error
    });
  }
};
0reactions
czcioucommented, Jun 24, 2016

@steffans is right.when change your interceptor code.the error disappear

Read more comments on GitHub >

github_iconTop Results From Across the Web

CORS issue with Vue.js - Stack Overflow
I have a proejct , which contains larvel api and vuejs. Vuej consuming larvel api fine but when call to other api is...
Read more >
How to consume APIs with Vuex, Pinia, and Axios
We're using the async/await format to fetch data from the endpoint, and using Axios to make the HTTP request. We'll make a request...
Read more >
Vue JS 2 Tutorial #32 - HTTP Requests - YouTube
COURSE LINKS:+ Repo - https://github.com/iamshaunjp/ vuejs -playlist+ Atom editor - https://atom.io/a+ Download GIT - https://git-scm.com/+ ...
Read more >
Adding Instance Properties - Vue.js
Let's say you're replacing the now-retired Vue Resource. You really enjoyed accessing request methods through this.$http and you want to do the same...
Read more >
Consume Remote API Data Via HTTP In A Vue.js Web ...
Things have only changed slightly between our vue-resource version and our axios version. Now we can call the $http.get and $http.post methods ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found