mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
fix(front): enhance error handling in file download components by refining error message extraction
This commit is contained in:
@@ -135,8 +135,8 @@ watch(
|
||||
}
|
||||
try {
|
||||
await downloadFileByShareId(id)
|
||||
} catch (error) {
|
||||
toast.error((error as any)?.data?.message || error)
|
||||
} catch (error: any) {
|
||||
toast.error(error?.data?.message || error?.message || error)
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
@@ -34,8 +34,8 @@ const handleDownload = async () => {
|
||||
throw new Error('获取token失败')
|
||||
}
|
||||
downloadFile(token)
|
||||
} catch (error) {
|
||||
toast.error((error as any)?.data?.message || error)
|
||||
} catch (error: any) {
|
||||
toast.error(error?.data?.message || error?.message || error)
|
||||
} finally {
|
||||
queryClient.invalidateQueries({ queryKey: ['share', id] })
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ const handlePreview = async () => {
|
||||
}
|
||||
}>(`/api/download?token=${token}`)
|
||||
previewText.value = r?.data?.data
|
||||
} catch (error) {
|
||||
toast.error((error as any)?.data?.message || error)
|
||||
} catch (error: any) {
|
||||
toast.error(error?.data?.message || error?.message || error)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user