1
0
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:
awu0403
2024-05-16 16:19:49 +08:00
committed by GitHub
parent 06de95840b
commit 6bd8d6dade
3 changed files with 77 additions and 31 deletions

View File

@@ -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;