mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 22:33:17 +00:00
update homepage get repo (#6077)
* Merge to get repo API * add-public-repo-list --------- Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com> Co-authored-by: r350178982 <32759763+r350178982@users.noreply.github.com>
This commit is contained in:
@@ -407,20 +407,27 @@ class SharedLibraries extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
seafileAPI.listRepos({type:'shared'}).then((res) => {
|
||||
let repoList = res.data.repos.map((item) => {
|
||||
return new Repo(item);
|
||||
if (!this.props.repoList) {
|
||||
seafileAPI.listRepos({type:'shared'}).then((res) => {
|
||||
let repoList = res.data.repos.map((item) => {
|
||||
return new Repo(item);
|
||||
});
|
||||
this.setState({
|
||||
loading: false,
|
||||
items: Utils.sortRepos(repoList, this.state.sortBy, this.state.sortOrder)
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
errorMsg: Utils.getErrorMsg(error, true)
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
loading: false,
|
||||
items: Utils.sortRepos(repoList, this.state.sortBy, this.state.sortOrder)
|
||||
items: Utils.sortRepos(this.props.repoList, this.state.sortBy, this.state.sortOrder)
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
errorMsg: Utils.getErrorMsg(error, true) // true: show login tip if 403
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sortItems = (sortBy, sortOrder) => {
|
||||
@@ -516,7 +523,8 @@ class SharedLibraries extends Component {
|
||||
}
|
||||
|
||||
SharedLibraries.propTypes = {
|
||||
inAllLibs: PropTypes.bool
|
||||
inAllLibs: PropTypes.bool,
|
||||
repoList: PropTypes.array,
|
||||
};
|
||||
|
||||
export default SharedLibraries;
|
||||
|
Reference in New Issue
Block a user