This commit is contained in:
caishi 2021-09-30 20:08:06 +08:00
parent 0fea52b923
commit 68a5ca9380
1 changed files with 6 additions and 3 deletions

View File

@ -120,12 +120,13 @@ function CoderDepot(props){
setTreeValue(url); setTreeValue(url);
getFileInfo(url,branchName); getFileInfo(url,branchName);
setType("file"); setType("file");
getReadmeInfo(url,branchName); // getReadmeInfo(url,branchName);
// setReadme(undefined);
}else{ }else{
setTreeValue(undefined); setTreeValue(undefined);
getDirInfo(branchName || defaultBranch); getDirInfo(branchName || defaultBranch);
setType("dir"); setType("dir");
getReadmeInfo('', branchName || defaultBranch); // getReadmeInfo('', branchName || defaultBranch);
} }
} }
},[projectsId,owner,pathname,defaultBranch]) },[projectsId,owner,pathname,defaultBranch])
@ -170,6 +171,7 @@ function CoderDepot(props){
// setReadme(result.data.readme); // setReadme(result.data.readme);
setEditReadme(false); setEditReadme(false);
setHide(true); setHide(true);
getReadmeInfo('', branchName || defaultBranch);
} }
setTimeout(function(){setIsSpin(false);},500); setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);}) }).catch(error=>{setIsSpin(false);})
@ -202,16 +204,17 @@ function CoderDepot(props){
setDirInfo(undefined); setDirInfo(undefined);
setFileInfo(en); setFileInfo(en);
setType(en.type); setType(en.type);
setReadme(undefined);
}else{ }else{
setFileInfo(undefined); setFileInfo(undefined);
setDirInfo(en); setDirInfo(en);
setType("dir"); setType("dir");
getReadmeInfo(path, branchName || defaultBranch);
} }
let c = result.data.last_commit let c = result.data.last_commit
setLastCommit(c && c.commit); setLastCommit(c && c.commit);
setLastCommitAuthor(c && c.committer); setLastCommitAuthor(c && c.committer);
setMainFlag(false); setMainFlag(false);
// setReadme(result.data.readme);
setReadOnly(true); setReadOnly(true);
setReadOnly(!editReadme); setReadOnly(!editReadme);
setHide(true); setHide(true);