Browse Source

Enable to show document upload error message

pull/341/head
Hironsan 5 years ago
parent
commit
c194fe202f
2 changed files with 19 additions and 7 deletions
  1. 21
      frontend/components/organisms/documents/DocumentUploadForm.vue
  2. 5
      frontend/store/documents.js

21
frontend/components/organisms/documents/DocumentUploadForm.vue

@ -12,6 +12,15 @@
ref="form"
v-model="valid"
>
<v-alert
v-show="showError"
v-model="showError"
type="error"
dismissible
>
The file could not be uploaded. Maybe invalid format.
Please check available formats carefully.
</v-alert>
<h2>Select a file format</h2>
<v-radio-group
v-model="selectedFormat"
@ -68,7 +77,8 @@ export default {
file: null,
selectedFormat: null,
fileFormatRules,
uploadFileRules
uploadFileRules,
showError: false
}
},
@ -99,8 +109,13 @@ export default {
format: this.selectedFormat.type,
file: this.file
})
this.reset()
this.cancel()
.then((response) => {
this.reset()
this.cancel()
})
.catch(() => {
this.showError = true
})
}
}
}

5
frontend/store/documents.js

@ -111,13 +111,10 @@ export const actions = {
'Content-Type': 'multipart/form-data'
}
}
DocumentService.uploadFile(data.projectId, formData, config)
return DocumentService.uploadFile(data.projectId, formData, config)
.then((response) => {
dispatch('getDocumentList', data)
})
.catch((error) => {
alert(error)
})
.finally(() => {
commit('setLoading', false)
})

Loading…
Cancel
Save