张延森 3 gadus atpakaļ
vecāks
revīzija
6c6e720c80
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3
    2
      src/utils/request.js

+ 3
- 2
src/utils/request.js Parādīt failu

71
 });
71
 });
72
 
72
 
73
 request.interceptors.response.use(async (response) => {
73
 request.interceptors.response.use(async (response) => {
74
-  const contextType = response.headers.get('content-type');
74
+  const { headers } = response;
75
+  const contextType = headers.get('Content-Type');
75
   if (contextType.indexOf('json') > -1) {
76
   if (contextType.indexOf('json') > -1) {
76
     const result = await response.clone().json();
77
     const result = await response.clone().json();
77
     if (result.token) {
78
     if (result.token) {
86
   
87
   
87
   if (contextType.indexOf('application/vnd.ms-excel') > -1) {
88
   if (contextType.indexOf('application/vnd.ms-excel') > -1) {
88
     const data = await response.clone().blob();
89
     const data = await response.clone().blob();
89
-    const content = response.headers.get('content-disposition');
90
+    const content = headers.get('Content-Disposition');
90
     const fileName = content.replace('attachment;filename=', '')
91
     const fileName = content.replace('attachment;filename=', '')
91
     downloadBlob(decodeURIComponent(fileName), data)
92
     downloadBlob(decodeURIComponent(fileName), data)
92
   }
93
   }