fix: send error msg
This commit is contained in:
@@ -82,7 +82,9 @@ export class FileService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async deleteAdminFile(id: number): Promise<ApiResponse> {
|
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> }> {
|
static async downloadAdminFile(id: number): Promise<{ data: Blob; headers: Record<string, string> }> {
|
||||||
|
|||||||
@@ -386,7 +386,6 @@ interface InputStatus {
|
|||||||
loading: boolean
|
loading: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BoxIcon,
|
BoxIcon,
|
||||||
EyeIcon,
|
EyeIcon,
|
||||||
@@ -524,12 +523,13 @@ const handleSubmit = async () => {
|
|||||||
alertStore.showAlert('无效的取件码', 'error')
|
alertStore.showAlert('无效的取件码', 'error')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alertStore.showAlert('获取文件失败', 'error')
|
alertStore.showAlert('获取文件失败:' + res.detail, 'error')
|
||||||
console.log(res)
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err: unknown) {
|
||||||
console.error('取件失败:', err)
|
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 {
|
} finally {
|
||||||
inputStatus.value.readonly = false
|
inputStatus.value.readonly = false
|
||||||
inputStatus.value.loading = false
|
inputStatus.value.loading = false
|
||||||
|
|||||||
Reference in New Issue
Block a user