Answer the question
In order to leave comments, you need to log in
Getting public API data via Axios in Vue?
I make a request to a public service through Axios, but an empty object arrives, tell me where is the error?
File with axios object:
import axios from 'axios'
export const HTTP = axios.create({
baseURL: 'https://frontend-test-case.azurewebsites.net',
timeout: 10000
})
export const Routes = {
getList: '/api/report/card',
}
mutations: {
list(state) {
HTTP.post(Routes.getList, {
params: {
period: 2,
date: "2019-03-04T15:47:59.784Z"
}
})
.then(data => {
state.list = data;
setTimeout(() => {
console.log(state.list)
}, 400);
})
.catch(error => {
console.log(error);
});
}
Answer the question
In order to leave comments, you need to log in
Maybe not params, but data? You send POST.
Or so in general (I don’t remember how it’s true in axios:
{
"period": 0,
"date": "2019-03-05T15:12:13.319Z"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question