I'm having an issue where I think axios is querying the wrong URL just before query is sent.
getShows : function(){
if( ! this.query ) return false;
var getURL = this.makeUrlFromObject(this.query);
console.log('getURL', getURL);
var self = this;
axios.get(getURL).then(function(response){
console.log('response.data', response.data)
self.shows = response.data;
});
},
makeUrlFromObject : function(query){
var queryArray = [];
for (var prop in query) {
if(!query.hasOwnProperty(prop)) continue;
queryArray.push(prop + "=" + query[prop]);
}
var url = this.apiUrl + '?' + queryArray.join('&');
return url;
},
...
Running the getShows
returns the following in the console:
1. getURL /api/all?date=20180131
2. GET http://website.dev/shows/false 404 (Not Found) false:1
3. response.data (3) [{…}, {…}, {…}]
I can't seem to diagnose where this false:1
is coming from. The request and response are both working, just this extra request seems to crop up from nowhere.