fix: task attachment upload
This commit is contained in:
parent
c7b4c25caa
commit
6d472bf5ca
1 changed files with 5 additions and 7 deletions
|
@ -143,7 +143,7 @@ export default class AbstractService {
|
||||||
getReplacedRoute(path, pathparams) {
|
getReplacedRoute(path, pathparams) {
|
||||||
let replacements = this.getRouteReplacements(path, pathparams)
|
let replacements = this.getRouteReplacements(path, pathparams)
|
||||||
return Object.entries(replacements).reduce(
|
return Object.entries(replacements).reduce(
|
||||||
(result, [parameter, value]) => result.replace(parameter, value),
|
(result, [parameter, value]) => result.replace(parameter, value),
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ export default class AbstractService {
|
||||||
* @param model
|
* @param model
|
||||||
* @returns {Q.Promise<unknown>}
|
* @returns {Q.Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
async post(url, model) {
|
async post(url, model) {
|
||||||
const cancel = this.setLoading()
|
const cancel = this.setLoading()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -462,8 +462,6 @@ export default class AbstractService {
|
||||||
* @returns {Q.Promise<unknown>}
|
* @returns {Q.Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
async uploadFormData(url, formData) {
|
async uploadFormData(url, formData) {
|
||||||
console.log(formData, formData._boundary)
|
|
||||||
|
|
||||||
const cancel = this.setLoading()
|
const cancel = this.setLoading()
|
||||||
try {
|
try {
|
||||||
const response = await this.http.put(
|
const response = await this.http.put(
|
||||||
|
@ -472,14 +470,14 @@ export default class AbstractService {
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type':
|
'Content-Type':
|
||||||
'multipart/form-data; boundary=' + formData._boundary,
|
'multipart/form-data; boundary=' + formData._boundary,
|
||||||
},
|
},
|
||||||
onUploadProgress: progressEvent => {
|
onUploadProgress: progressEvent => {
|
||||||
this.uploadProgress = Math.round((progressEvent.loaded * 100) / progressEvent.total)
|
this.uploadProgress = Math.round((progressEvent.loaded * 100) / progressEvent.total)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
this.modelCreateFactory(response.data)
|
return this.modelCreateFactory(response.data)
|
||||||
} finally {
|
} finally {
|
||||||
this.uploadProgress = 0
|
this.uploadProgress = 0
|
||||||
cancel()
|
cancel()
|
||||||
|
|
Loading…
Add table
Reference in a new issue