fix: send error msg

This commit is contained in:
Lan
2025-09-04 14:02:02 +08:00
parent 0bd5d42a36
commit f08adee7fa
2 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -82,7 +82,9 @@ export class FileService {
}
static async deleteAdminFile(id: number): Promise<ApiResponse> {
return api.post('/admin/file/delete', { id })
return api.delete('/admin/file/delete', {
data: { id }
})
}
static async downloadAdminFile(id: number): Promise<{ data: Blob; headers: Record<string, string> }> {
+5 -5
View File
@@ -386,7 +386,6 @@ interface InputStatus {
loading: boolean
}
import {
BoxIcon,
EyeIcon,
@@ -524,12 +523,13 @@ const handleSubmit = async () => {
alertStore.showAlert('无效的取件码', 'error')
}
} else {
alertStore.showAlert('获取文件失败', 'error')
console.log(res)
alertStore.showAlert('获取文件失败' + res.detail, 'error')
}
} catch (err) {
} catch (err: unknown) {
console.error('取件失败:', err)
alertStore.showAlert('取件失败,请稍后重试', 'error')
const error = err as { response?: { data?: { detail?: string } }; message?: string }
const errorMessage = error?.response?.data?.detail || error?.message || '未知错误'
alertStore.showAlert('取件失败,请稍后重试:' + errorMessage, 'error')
} finally {
inputStatus.value.readonly = false
inputStatus.value.loading = false