File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
components/organisms/documents Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 12
12
ref =" form"
13
13
v-model =" valid"
14
14
>
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 >
15
24
<h2 >Select a file format</h2 >
16
25
<v-radio-group
17
26
v-model =" selectedFormat"
@@ -68,7 +77,8 @@ export default {
68
77
file: null ,
69
78
selectedFormat: null ,
70
79
fileFormatRules,
71
- uploadFileRules
80
+ uploadFileRules,
81
+ showError: false
72
82
}
73
83
},
74
84
@@ -99,8 +109,13 @@ export default {
99
109
format: this .selectedFormat .type ,
100
110
file: this .file
101
111
})
102
- this .reset ()
103
- this .cancel ()
112
+ .then ((response ) => {
113
+ this .reset ()
114
+ this .cancel ()
115
+ })
116
+ .catch (() => {
117
+ this .showError = true
118
+ })
104
119
}
105
120
}
106
121
}
Original file line number Diff line number Diff line change @@ -111,13 +111,10 @@ export const actions = {
111
111
'Content-Type' : 'multipart/form-data'
112
112
}
113
113
}
114
- DocumentService . uploadFile ( data . projectId , formData , config )
114
+ return DocumentService . uploadFile ( data . projectId , formData , config )
115
115
. then ( ( response ) => {
116
116
dispatch ( 'getDocumentList' , data )
117
117
} )
118
- . catch ( ( error ) => {
119
- alert ( error )
120
- } )
121
118
. finally ( ( ) => {
122
119
commit ( 'setLoading' , false )
123
120
} )
You can’t perform that action at this time.
0 commit comments