We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc350c2 commit a35ddadCopy full SHA for a35ddad
1 file changed
ui/src/request/index.ts
@@ -282,6 +282,17 @@ export const exportFile: (
282
transformResponse: [
283
function (data, headers) {
284
// 在这里可以访问 headers
285
+ if (data.type === 'application/json') {
286
+ data.text().then((text: string) => {
287
+ try {
288
+ const json = JSON.parse(text)
289
+ MsgError(json.message || text)
290
+ } catch {
291
+ MsgError(text)
292
+ }
293
+ })
294
+ throw new Error('Response is not a valid file')
295
296
// const contentType = headers['content-type'];
297
const contentDisposition = headers['content-disposition']
298
// console.log('Content-Type:', contentType);
@@ -306,7 +317,7 @@ export const exportFile: (
306
317
window.URL.revokeObjectURL(link.href)
307
318
}
308
319
return true
309
- })
320
+ }).catch(()=>{})
310
321
311
322
312
323
export const exportExcelPost: (
0 commit comments