fix: notification on quiz update and mention

This commit is contained in:
Jannat Patel
2026-01-07 14:28:56 +05:30
parent ea94813d94
commit 45e98b9ddc
12 changed files with 384 additions and 152 deletions

View File

@@ -618,15 +618,19 @@ export function singularize(word) {
)
}
export const validateFile = async (file, showToast = true) => {
export const validateFile = async (
file,
showToast = true,
fileType = 'image'
) => {
const error = (msg) => {
if (showToast) toast.error(msg)
console.error(msg)
return msg
}
if (!file.type.startsWith('image/')) {
return error(__('Only image file is allowed.'))
console.log(file.type, fileType)
if (!file.type.startsWith(`${fileType}/`)) {
return error(__(`Only ${fileType} file is allowed.`))
}
if (file.type === 'image/svg+xml') {