Use loading page for tournament statistics page
This commit is contained in:
parent
c380c2ae80
commit
8b773d5067
|
|
@ -344,6 +344,7 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
|
|||
storeOptionalToken(error.response);
|
||||
}
|
||||
action.parameters.errorCallback();
|
||||
return Object.assign({}, state, {loaded: true});
|
||||
});
|
||||
return state;
|
||||
case actionTypesTournamentStatistics.INT_REQUEST_TOURNAMENT_STATISTICS:
|
||||
|
|
@ -361,11 +362,12 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
|
|||
storeOptionalToken(error.response);
|
||||
}
|
||||
action.parameters.errorCallback();
|
||||
return Object.assign({}, state, {loaded: true});
|
||||
});
|
||||
return Object.assign({}, state, action.parameters.tournamentInfo);
|
||||
return Object.assign({}, state, action.parameters.tournamentInfo, {loaded: true});
|
||||
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
|
||||
action.parameters.successCallback();
|
||||
return Object.assign({}, state, action.parameters.tournamentStatistics);
|
||||
return Object.assign({}, state, action.parameters.tournamentStatistics, {loaded: true});
|
||||
default: return state;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export const defaultStateTournamentStatistics = {
|
|||
owner_username: '',
|
||||
isPublic: '',
|
||||
|
||||
loaded: false,
|
||||
statistics_available: false,
|
||||
|
||||
most_dominant_team: {},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {requestTournamentStatistics} from '../js/api';
|
|||
import {EditButton, TournamentStatusBar, TournamentStatusBarButton} from '../js/components/TournamentStatusBar';
|
||||
import Navbar from 'react-bootstrap/Navbar';
|
||||
import {TournamentBigImage} from '../js/components/TournamentBigImage';
|
||||
import {LoadingPage} from '../js/components/LoadingPage';
|
||||
|
||||
class StatisticsTournamentPage extends React.Component {
|
||||
static async getInitialProps({query}) {
|
||||
|
|
@ -24,6 +25,10 @@ class StatisticsTournamentPage extends React.Component {
|
|||
render() {
|
||||
const {tournamentStatistics} = this.props;
|
||||
|
||||
if (!tournamentStatistics.loaded) {
|
||||
return <LoadingPage title='turnie.re' text='Statistiken zum Turnier werden geladen...'/>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
|
|
|
|||
Loading…
Reference in New Issue