add loading spinner and error handling for codeOverview

This commit is contained in:
Eduard Heimbuch
2020-01-08 11:01:00 +01:00
parent c73e85e3d6
commit 987436e335
2 changed files with 19 additions and 16 deletions

View File

@@ -27,7 +27,6 @@ type Props = WithTranslation & {
sources: File;
// dispatch props
fetchBranches: (p: Repository) => void;
fetchSources: (p1: Repository, p2: string, p3: string) => void;
// Context props
@@ -50,9 +49,8 @@ class Sources extends React.Component<Props, State> {
}
componentDidMount() {
const { fetchBranches, repository, revision, path, fetchSources } = this.props;
const { repository, revision, path, fetchSources } = this.props;
fetchBranches(repository);
fetchSources(repository, this.decodeRevision(revision), path);
this.redirectToDefaultBranch();
@@ -153,7 +151,6 @@ const mapStateToProps = (state: any, ownProps: Props) => {
const decodedRevision = revision ? decodeURIComponent(revision) : undefined;
const loading = isFetchBranchesPending(state, repository);
const error = getFetchBranchesFailure(state, repository);
const branches = getBranches(state, repository);
const currentFileIsDirectory = decodedRevision
? isDirectory(state, repository, decodedRevision, path)
: isDirectory(state, repository, revision, path);
@@ -165,7 +162,6 @@ const mapStateToProps = (state: any, ownProps: Props) => {
path,
loading,
error,
branches,
currentFileIsDirectory,
sources
};
@@ -173,9 +169,6 @@ const mapStateToProps = (state: any, ownProps: Props) => {
const mapDispatchToProps = (dispatch: any) => {
return {
fetchBranches: (repository: Repository) => {
dispatch(fetchBranches(repository));
},
fetchSources: (repository: Repository, revision: string, path: string) => {
dispatch(fetchSources(repository, revision, path));
}