File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 5656 ref =" snapshotform"
5757 v-model =" valid"
5858 lazy-validation
59+ @submit =" saveSnapshot"
5960 >
6061 <v-text-field
6162 v-model =" selected.title"
8182 return-object
8283 required
8384 @update:search-input =" queryAndSetMunicipalities"
84- :rules =" [(value) => value && value.bfsNumber ? true : $t('municipalityMandatory')]"
85+ :rules =" [
86+ (municipality) => municipality && municipality.bfsNumber || $t('municipalityMandatory')
87+ ]"
8588 :hide-no-data =" !municipalities.length"
8689 >
8790 <v-list-item slot =" no-data" >
9598 accept =" .json"
9699 :label =" $t('file')"
97100 truncate-length =" 20"
98- :rules =" [v => !!v || $t('mandatory')]"
101+ :rules =" [
102+ file => !!snapshot.datafile ||
103+ !!(file && file.name && file.type === 'application/json') ||
104+ $t('mandatory')
105+ ]"
99106 :required =" isNew"
100107 @change =" selectFile"
101108 >
119126 {{ $t('cancel') }}
120127 </v-btn >
121128 <v-btn
122- color = " primary "
123- @click = " saveSnapshot "
129+ type = " submit "
130+ color = " primary "
124131 >
125132 {{ $t('save') }}
126133 </v-btn >
@@ -212,7 +219,8 @@ export default {
212219 });
213220 return data .municipalities .edges .map (({ node }) => node);
214221 },
215- async saveSnapshot () {
222+ async saveSnapshot (event ) {
223+ event .preventDefault ();
216224 if (! this .$refs .snapshotform .validate ()) {
217225 return ;
218226 }
You can’t perform that action at this time.
0 commit comments