let url = this.globalAPIBaseUrl + 'program/' + this.tmsID + '/updateposters/?posterType=' + imageType;
let j = [{
posterType: imageType,
url: imageUrl
}];
axios.patch(url, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('accessToken')
}
}, j, {
onUploadProgress: progressEvent => {
this.basic.status = 'Uploaded: ' + progressEvent.loaded + 'b of ' + progressEvent.total + 'b'
}
}).then(response => (this.handleUploadComplete(response)));
before i put in the "headers" is worked fine, and when i use the same auth headers, but no "j" data variable elsewhere it also works fine.
Any advice, i'm kinda new here with axios. (this is in vue2.js btw)
data
should be the second parameter, and the third parameter is config
object, where you can set headers
and onUploadProgress
callback
axios.patch(url, j, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('accessToken')
},
onUploadProgress: progressEvent => {
this.basic.status = 'Uploaded: ' + progressEvent.loaded + 'b of ' + progressEvent.total + 'b'
}
}).then(response => (this.handleUploadComplete(response)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.