Skip to content

Commit c194fe2

Browse files
committed
Enable to show document upload error message
1 parent c2aad87 commit c194fe2

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

frontend/components/organisms/documents/DocumentUploadForm.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
ref="form"
1313
v-model="valid"
1414
>
15+
<v-alert
16+
v-show="showError"
17+
v-model="showError"
18+
type="error"
19+
dismissible
20+
>
21+
The file could not be uploaded. Maybe invalid format.
22+
Please check available formats carefully.
23+
</v-alert>
1524
<h2>Select a file format</h2>
1625
<v-radio-group
1726
v-model="selectedFormat"
@@ -68,7 +77,8 @@ export default {
6877
file: null,
6978
selectedFormat: null,
7079
fileFormatRules,
71-
uploadFileRules
80+
uploadFileRules,
81+
showError: false
7282
}
7383
},
7484
@@ -99,8 +109,13 @@ export default {
99109
format: this.selectedFormat.type,
100110
file: this.file
101111
})
102-
this.reset()
103-
this.cancel()
112+
.then((response) => {
113+
this.reset()
114+
this.cancel()
115+
})
116+
.catch(() => {
117+
this.showError = true
118+
})
104119
}
105120
}
106121
}

frontend/store/documents.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,10 @@ export const actions = {
111111
'Content-Type': 'multipart/form-data'
112112
}
113113
}
114-
DocumentService.uploadFile(data.projectId, formData, config)
114+
return DocumentService.uploadFile(data.projectId, formData, config)
115115
.then((response) => {
116116
dispatch('getDocumentList', data)
117117
})
118-
.catch((error) => {
119-
alert(error)
120-
})
121118
.finally(() => {
122119
commit('setLoading', false)
123120
})

0 commit comments

Comments
 (0)