鉴权体系重构 cont.

This commit is contained in:
黄心宇 2024-01-11 15:50:29 +08:00
parent 49c4843448
commit 3f342b826d
3 changed files with 10 additions and 12 deletions

View File

@ -27,7 +27,6 @@ function HeaderPage(props){
function getPersonList(){
getHomePageList(id).then(result=>{
console.log(123124125);
if(result){
setPersonList(result.data.rows);
}

View File

@ -90,7 +90,6 @@ export function delNewsMyList(id){
/**开源项目 */
export function getProjectsLists(id,params){
console.log('==========================project/list==================================')
return fetch({
url:`/zone/open/${id}/project/list`,
method: 'get',

View File

@ -5,21 +5,23 @@ function beforeFetch(actionUrl){
if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true;
}
const config = {
baseURL: actionUrl,
timeout: 1800000, // 请求超时时间
}
if (deptId) {
// 用于权限区分
config.headers = {
'Dept-Id': deptId
}
}
console.log(config);
const service = axios.create(config);
service.interceptors.request.use(request => {
let deptId = sessionStorage.getItem('deptId')
if (deptId) {
// 用于权限区分
request.headers['Dept-Id'] = deptId
}
return request
})
service.interceptors.response.use(
response => {
const res = response||{};
@ -47,8 +49,6 @@ function beforeFetch(actionUrl){
}
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
let actionUrl = settings && settings.common.zone +'/api';
const deptId = sessionStorage.getItem('deptId')
console.log(deptId)
const service = beforeFetch(actionUrl);
export const httpUrl = actionUrl;