代码库二级页面发行版标签跳转链接错误,代码库页面发行版及时刷新

This commit is contained in:
谢思 2021-09-30 20:30:15 +08:00
parent 4c0f059ae5
commit 30acf6ed34
2 changed files with 18 additions and 5 deletions

View File

@ -67,6 +67,7 @@ function CoderDepot(props){
const [ editReadme , setEditReadme ] = useState(false);
const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true);
const [ releaseVersions , setReleaseVersions] = useState(undefined);
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -130,6 +131,18 @@ function CoderDepot(props){
}
},[projectsId,owner,pathname,defaultBranch])
useEffect(()=>{
axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{
if(result && result.data){
const release = {
"list":result.data.releases,
"total_count":result.data.releases.length
}
setReleaseVersions(release);
}
})
},[])
// readme
function getReadmeInfo(path, ref) {
axios.get(`/${owner}/${projectsId}/readme.json`, {
@ -542,13 +555,13 @@ function CoderDepot(props){
}
{/* 发布 */}
{
projectDetail && projectDetail.release_versions &&
releaseVersions &&
<React.Fragment>
<Divider />
<Releases
owner={owner}
projectsId={projectsId}
releaseVersions={projectDetail.release_versions}
owner={owner}
projectsId={projectsId}
releaseVersions={releaseVersions}
history={props.history}
distribution={distribution}
/>

View File

@ -63,7 +63,7 @@ function version(props) {
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
<span className="color-grey-3 mt15 font-12">
<i className="iconfont icon-biaoqianicon mr3 font-14"></i>
<Link className="hover" to={`/${owner}/${projectsId}/tree/${item.name}`} >{item.tag_name}</Link>
<Link className="hover" to={`/${owner}/${projectsId}/tree/${item.tag_name}`} >{item.tag_name}</Link>
</span>
<span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/>