issue页面可能空白问题修复、服务端请求添加header表示
This commit is contained in:
parent
02928e5e28
commit
338d326971
|
@ -15,8 +15,9 @@ app.use('/build', express.static('build'));
|
|||
const options = (target) => {
|
||||
return {
|
||||
target: target,
|
||||
changeOrigin: false, // 不允许在请求头中更改主机
|
||||
changeOrigin: process.env.NODE_ENV === 'dev' ? true : false, // 服务器不允许在请求头中更改主机
|
||||
timeout: 30000,
|
||||
secure: process.env.NODE_ENV === 'dev' ? false : true, // 忽略证书验证
|
||||
onProxyRes: (proxyRes, req, res) => {
|
||||
// 代理成功后输出日志
|
||||
Logger.info(`Proxy to ${req.url} responded with status ${proxyRes.statusCode}`);
|
||||
|
|
|
@ -47,4 +47,5 @@ export const changeHead = async ({ key }, params) => {
|
|||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ class Detail extends Component {
|
|||
defaultBranch: data.default_branch
|
||||
});
|
||||
// seo优化设置
|
||||
let keyWords=`${owner},${projectsId}${ data.topics.length > 0 && ','}${ data.topics.length > 0 && data.topics.map(item => item.name).join(',') }`;
|
||||
let keyWords=`${owner},${projectsId}${ data.topics && data.topics.length > 0 && ','}${ data.topics && data.topics.length > 0 && data.topics.map(item => item.name).join(',') }`;
|
||||
let title= `${owner}/${projectsId}${data.description?':'+data.description:''}`;
|
||||
setSeoMeta(keyWords,title,data.description || '',`/${owner}/${projectsId}`,owner,projectsId);
|
||||
}
|
||||
|
|
|
@ -23,70 +23,61 @@ axiosInstance.interceptors.response.use(
|
|||
}
|
||||
)
|
||||
|
||||
const setHead = () => {
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
axiosInstance.defaults.headers.isServer = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
export async function getProjectFunc (owner, projectsId) {
|
||||
const url = `${baseUrl}/${owner}/${projectsId}/simple.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
export async function getProjectDetailFunc (owner, projectsId) {
|
||||
const url = `${baseUrl}/${owner}/${projectsId}/detail.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
export async function getProjectEntriesFunc (owner, projectsId, branch) {
|
||||
const url = `${baseUrl}/${owner}/${projectsId}/entries.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url, {params: { ref: branch }});
|
||||
}
|
||||
|
||||
export async function getBannerFunc (owner, projectsId) {
|
||||
const url = `${baseUrl}/${owner}/${projectsId}/menu_list.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
export async function getProjectReadMe (owner, projectsId, branch) {
|
||||
const url = `${baseUrl}/${owner}/${projectsId}/readme.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url, {params: { ref: branch }});
|
||||
}
|
||||
|
||||
export async function getOwnerInfo (owner) {
|
||||
const url = `${baseUrl}/owners/${owner}.json`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
|
||||
export async function getMainInfos (deptId) {
|
||||
const url = `${baseZoneUrl}/zone/open/zoneKey/${deptId}`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
export async function getNewsDetail (id) {
|
||||
const url = `${baseZoneUrl}/cms/doc/open/${id}`;
|
||||
if (__SERVER__) {
|
||||
axiosInstance.defaults.headers.cookie = domObj.window.document.cookie
|
||||
}
|
||||
setHead()
|
||||
return axiosInstance.get(url);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue