This commit is contained in:
caishi 2020-09-28 17:56:27 +08:00
parent 45273782c5
commit 593f76bba0
2 changed files with 5 additions and 15 deletions

View File

@ -1,12 +1,9 @@
import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage , isDev, queryString } from 'educoder';
import { broadcastChannelOnmessage, isDev, queryString } from 'educoder';
import { notification } from 'antd';
import cookie from 'react-cookies';
import './index.css';
const $ = window.$;
let timestamp;
let checkSubmitFlg = false;
let message501 = false;
broadcastChannelOnmessage('refreshPage', () => {
@ -64,8 +61,8 @@ export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
var
// proxy = "http://localhost:3000"
proxy = "https://testforgeplus.trustie.net"
// proxy = "http://localhost:3000"
proxy = "https://testforgeplus.trustie.net"
const requestMap = {};
window.setfalseInRequestMap = function (keyName) {
@ -109,12 +106,10 @@ export function initAxiosInterceptors(props) {
});
axios.interceptors.response.use(function (response) {
// console.log(".............")
if (response === undefined) {
return
}
const config = response.config
const config = response.config;
if (response.data.status === -1) {
if (window.location.pathname.startsWith('/tasks/')) {
props.showSnackbar(response.data.message || '服务器异常,请联系管理员。')
@ -127,12 +122,10 @@ export function initAxiosInterceptors(props) {
},
});
}
throw new axios.Cancel('Operation canceled by the user.');
}
if (response.data.status === 403 || response.data.status === "403") {
locationurl('/403');
}
@ -159,8 +152,6 @@ export function initAxiosInterceptors(props) {
message501 = false
}, 2000);
}
requestMap[response.config.url] = false;
setpostcookie();
return response;

View File

@ -13,7 +13,6 @@ function Dispose(props){
const [ visible , setVisible ] = useState(false);
const [ ymlValue , setYmlValue ] = useState("");
const [ sha , setSha ] = useState(undefined);
const [ six , setSix ] = useState(undefined);
const [ fileLanguage , setFileLanguage ] = useState(undefined);
const [ first , setFirst ] = useState(false);