File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { ResponseError } from 'umi-request';
55import { queryQuarkInfo , queryQuarkLayout , queryQuarkMenus , queryAccountInfo } from '@/services/quark' ;
66import defaultSettings from '../config/defaultSettings' ;
77import logo from './assets/logo.png' ;
8+ import { Response } from "express" ;
89
910export async function getInitialState ( ) : Promise < {
1011 accountInfo ?: API . AccountInfo ;
@@ -118,6 +119,17 @@ const errorHandler = (error: ResponseError) => {
118119
119120export const request : RequestConfig = {
120121 errorHandler : errorHandler ,
122+ responseInterceptors : [
123+ ( response , options ) => {
124+ if ( response . status == 208 ) { //跳转新的url
125+ const locationUrl = response . headers . get ( 'Location' ) ;
126+ if ( locationUrl ) {
127+ window . open ( locationUrl , response . headers . get ( 'Target' ) || '_blank' ) ;
128+ }
129+ }
130+ return response ;
131+ }
132+ ] ,
121133 // 请求拦截器
122134 requestInterceptors : [
123135 ( url : string , options ) => {
You can’t perform that action at this time.
0 commit comments