update
This commit is contained in:
parent
45273782c5
commit
593f76bba0
|
@ -1,12 +1,9 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { requestProxy } from "./indexEduplus2RequestProxy";
|
import { requestProxy } from "./indexEduplus2RequestProxy";
|
||||||
import { broadcastChannelOnmessage , isDev, queryString } from 'educoder';
|
import { broadcastChannelOnmessage, isDev, queryString } from 'educoder';
|
||||||
import { notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
const $ = window.$;
|
|
||||||
let timestamp;
|
|
||||||
let checkSubmitFlg = false;
|
|
||||||
let message501 = false;
|
let message501 = false;
|
||||||
|
|
||||||
broadcastChannelOnmessage('refreshPage', () => {
|
broadcastChannelOnmessage('refreshPage', () => {
|
||||||
|
@ -63,9 +60,9 @@ window._debugType = debugType;
|
||||||
export function initAxiosInterceptors(props) {
|
export function initAxiosInterceptors(props) {
|
||||||
initOnlineOfflineListener()
|
initOnlineOfflineListener()
|
||||||
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
|
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
|
||||||
var
|
var
|
||||||
// proxy = "http://localhost:3000"
|
// proxy = "http://localhost:3000"
|
||||||
proxy = "https://testforgeplus.trustie.net"
|
proxy = "https://testforgeplus.trustie.net"
|
||||||
|
|
||||||
const requestMap = {};
|
const requestMap = {};
|
||||||
window.setfalseInRequestMap = function (keyName) {
|
window.setfalseInRequestMap = function (keyName) {
|
||||||
|
@ -109,12 +106,10 @@ export function initAxiosInterceptors(props) {
|
||||||
});
|
});
|
||||||
|
|
||||||
axios.interceptors.response.use(function (response) {
|
axios.interceptors.response.use(function (response) {
|
||||||
|
|
||||||
// console.log(".............")
|
|
||||||
if (response === undefined) {
|
if (response === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const config = response.config
|
const config = response.config;
|
||||||
if (response.data.status === -1) {
|
if (response.data.status === -1) {
|
||||||
if (window.location.pathname.startsWith('/tasks/')) {
|
if (window.location.pathname.startsWith('/tasks/')) {
|
||||||
props.showSnackbar(response.data.message || '服务器异常,请联系管理员。')
|
props.showSnackbar(response.data.message || '服务器异常,请联系管理员。')
|
||||||
|
@ -127,12 +122,10 @@ export function initAxiosInterceptors(props) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new axios.Cancel('Operation canceled by the user.');
|
throw new axios.Cancel('Operation canceled by the user.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.data.status === 403 || response.data.status === "403") {
|
if (response.data.status === 403 || response.data.status === "403") {
|
||||||
|
|
||||||
locationurl('/403');
|
locationurl('/403');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,8 +152,6 @@ export function initAxiosInterceptors(props) {
|
||||||
message501 = false
|
message501 = false
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
requestMap[response.config.url] = false;
|
requestMap[response.config.url] = false;
|
||||||
setpostcookie();
|
setpostcookie();
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -13,7 +13,6 @@ function Dispose(props){
|
||||||
const [ visible , setVisible ] = useState(false);
|
const [ visible , setVisible ] = useState(false);
|
||||||
const [ ymlValue , setYmlValue ] = useState("");
|
const [ ymlValue , setYmlValue ] = useState("");
|
||||||
const [ sha , setSha ] = useState(undefined);
|
const [ sha , setSha ] = useState(undefined);
|
||||||
const [ six , setSix ] = useState(undefined);
|
|
||||||
const [ fileLanguage , setFileLanguage ] = useState(undefined);
|
const [ fileLanguage , setFileLanguage ] = useState(undefined);
|
||||||
const [ first , setFirst ] = useState(false);
|
const [ first , setFirst ] = useState(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue