Error message
Some checks failed
Cat or Not - frontend/inzynieria_frontend/pipeline/head There was a failure building this commit

This commit is contained in:
Novembert 2021-12-19 19:08:14 +01:00
parent 312b6e7b80
commit 02589af438

View File

@ -40,6 +40,9 @@
@change="onFileChange"
>
</div>
<p v-if="showError">
Akceptowane rozszerzenia to: jpg, jpeg, png
</p>
</div>
</div>
</template>
@ -65,7 +68,8 @@ export default {
url: null,
size: null,
file: null,
name: null
name: null,
showError: false
}
},
watch: {
@ -96,6 +100,11 @@ export default {
document.getElementById(this.id).click()
},
getFileInfo (file) {
const acceptedExtensions = ['jpg', 'jpeg', 'png']
const name = file.name
let extension = name.split('.')[name.split('.').length - 1]
extension = extension.toLowerCase()
if (acceptedExtensions.includes(extension)) {
try {
this.url = URL.createObjectURL(file)
this.name = file.name
@ -106,6 +115,9 @@ export default {
this.name = null
this.file = null
}
} else {
this.showError = true
}
}
}
}