adjust image field validation

pull/493/merge
Pete Matsyburka 3 months ago
parent aaae257c75
commit 20a082ae8e

@ -112,11 +112,23 @@ export default {
onSelectFiles (e) {
e.preventDefault()
this.uploadFiles(this.$refs.input.files).then(() => {
if (this.$refs.input) {
this.$refs.input.value = ''
const files = Array.from(this.$refs.input.files).filter((f) => {
if (this.accept === 'image/*') {
return f.type.startsWith('image')
} else {
return true
}
})
if (this.accept === 'image/*' && !files.length) {
alert(this.t('please_upload_an_image_file'))
} else {
this.uploadFiles(files).then(() => {
if (this.$refs.input) {
this.$refs.input.value = ''
}
})
}
},
async uploadFiles (files) {
this.isLoading = true

Loading…
Cancel
Save