refactor: updated the validateFile function in utils and reused it

This commit is contained in:
Joedeep Singh
2025-07-04 13:22:25 +00:00
parent 5f04607a44
commit d71f1c7f9a
4 changed files with 28 additions and 33 deletions

View File

@@ -151,7 +151,7 @@ import { computed, onMounted, reactive, inject } from 'vue'
import { FileText, X } from 'lucide-vue-next'
import { sessionStore } from '@/stores/session'
import { useRouter } from 'vue-router'
import { getFileSize } from '@/utils'
import { getFileSize, validateFile } from '@/utils'
const user = inject('$user')
const router = useRouter()
@@ -293,14 +293,6 @@ const removeImage = () => {
job.image = null
}
const validateFile = (file) => {
if (!file.type.startsWith('image/')) {
const errorMessage = __('Only image file is allowed.')
toast.error(errorMessage)
return errorMessage
}
}
const jobTypes = computed(() => {
return [
{ label: 'Full Time', value: 'Full Time' },