Browse Source

重定向优化

master
牛批的一批 5 years ago
parent
commit
f505c36b36
  1. 71
      src/api/api.js

71
src/api/api.js

@ -36,101 +36,69 @@ function combineSsoArgs(params) {
console.log(params) console.log(params)
} }
function sso_redict(response) {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
var arrdata = data.split('"')
return window.location.href = arrdata[3];
}
}
export const requestLogin = params => { return axios.post(`${url}/login`, params, postFormType).then(res => res.data); }; export const requestLogin = params => { return axios.post(`${url}/login`, params, postFormType).then(res => res.data); };
export const getUserListPage = params => { export const getUserListPage = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/users`, { params: params }); var res = axios.get(`${url}/jump/users`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const removeUser = params => { export const removeUser = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/user/del`, { params: params }); var res = axios.get(`${url}/jump/user/del`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const batchRemoveUser = params => { export const batchRemoveUser = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${base}/user/batchremove`, { params: params }); var res = axios.get(`${base}/user/batchremove`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const editUser = params => { export const editUser = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/user/modify`, { params: params }); var res = axios.get(`${url}/jump/user/modify`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const addUser = params => { export const addUser = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/user/add`, { params: params }); var res = axios.get(`${url}/jump/user/add`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const getUserHostList = params => { export const getUserHostList = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/user/hosts`, { params: params }); var res = axios.get(`${url}/jump/user/hosts`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const getHostUserList = params => { export const getHostUserList = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/host/users`, { params: params }); var res = axios.get(`${url}/jump/host/users`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
export const getHostUserAll = params => { export const getHostUserAll = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/hostuser`, { params: params }); var res = axios.get(`${url}/jump/hostuser`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
@ -138,11 +106,6 @@ export const getHostUserAll = params => {
export const getHostList = params => { export const getHostList = params => {
combineSsoArgs(params); combineSsoArgs(params);
var res = axios.get(`${url}/jump/hosts`, { params: params }); var res = axios.get(`${url}/jump/hosts`, { params: params });
res.then ( response => {
var data = response.data;
if (typeof data == "string" && data.match("<script language") != null) {
return window.location.href = "http://sso.cynking.cn/?do=login.s_login&appid=18";
}
});
res.then(sso_redict);
return res; return res;
}; };
Loading…
Cancel
Save