mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 03:41:12 +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:
@@ -16,7 +16,8 @@ import TopToolbar from './top-toolbar';
|
||||
const propTypes = {
|
||||
onShowSidePanel: PropTypes.func,
|
||||
onSearchedClick: PropTypes.func,
|
||||
inAllLibs: PropTypes.bool
|
||||
inAllLibs: PropTypes.bool,
|
||||
repoList: PropTypes.array,
|
||||
};
|
||||
|
||||
class PublicSharedView extends React.Component {
|
||||
@@ -35,21 +36,27 @@ class PublicSharedView extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
seafileAPI.listRepos({type: 'public'}).then((res) => {
|
||||
let repoList = res.data.repos.map(item => {
|
||||
let repo = new Repo(item);
|
||||
return repo;
|
||||
if (!this.props.repoList) {
|
||||
seafileAPI.listRepos({type:'public'}).then((res) => {
|
||||
let repoList = res.data.repos.map((item) => {
|
||||
return new Repo(item);
|
||||
});
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
repoList: Utils.sortRepos(repoList, this.state.sortBy, this.state.sortOrder)
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
errMessage: Utils.getErrorMsg(error, true)
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
repoList: Utils.sortRepos(repoList, this.state.sortBy, this.state.sortOrder)
|
||||
repoList: Utils.sortRepos(this.props.repoList, this.state.sortBy, this.state.sortOrder)
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
errorMsg: Utils.getErrorMsg(error, true) // true: show login tip if 403
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onItemUnshare = (repo) => {
|
||||
|
Reference in New Issue
Block a user