我想要更新状态,但当我想做'put‘时,它不工作,因为axios.put中的axios没有定义。你能帮帮我吗?
getAbsencesByRequestId(reqId) {
axios.get(REQUESTID_URL + reqId).then(response => {
this.collaboId = response.data[0].collabId;
this.beginDate = response.data[0].startDate;
this.finishDate = response.data[0].endDate;
this.reason = response.data[0].type;
}, (error) => {
console.log(error.response.status)
}) axios.put(REQUEST_URL + reqId, {
collabId: this.collaboId,
startDate: this.beginDate,
endDate: this.finishDate,
status: 'VALIDATED',
type: this.reason
})
},发布于 2018-06-01 07:10:34
你应该正确管理你的请求的顺序
axios.get(url /*optional payload and headers*/).then((getResponse) => {
//do GET stuff with response
}).then(() => {
//do PUT call
axios.put(url, /*optional payload and headers*/).then((putResponse) => {
//do PUT stuff with response
})
}).catch((e) => {
//handle the error
})https://stackoverflow.com/questions/50627968
复制相似问题