From 5589e8c97e168813520d67a1aede731a0b55d9c5 Mon Sep 17 00:00:00 2001 From: Felix Hamme Date: Thu, 20 Jun 2019 16:10:17 +0200 Subject: [PATCH] Use loading page for tournament edit page --- pages/tournament-edit.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pages/tournament-edit.js b/pages/tournament-edit.js index d1eaeaf..aa3c1df 100644 --- a/pages/tournament-edit.js +++ b/pages/tournament-edit.js @@ -19,6 +19,7 @@ import 'bootstrap/dist/css/bootstrap.min.css'; import '../static/css/everypage.css'; import '../static/css/index.css'; +import {LoadingPage} from '../js/components/LoadingPage'; class EditTournamentPage extends React.Component { static async getInitialProps({query}) { @@ -29,26 +30,31 @@ class EditTournamentPage extends React.Component { super(props); this.state = { - validCode: false + validCode: false, + loaded: false }; } componentDidMount() { requestTournament(this.props.query.code, () => { - this.setState({validCode: true}); + this.setState({validCode: true, loaded: true}); if (this._edittournamentcontent != null) { this._edittournamentcontent.notifyOfContentUpdate(); } }, () => { - this.setState({validCode: false}); + this.setState({validCode: false, loaded: true}); }); } render() { - const {validCode} = this.state; + const {validCode, loaded} = this.state; const {tournamentname, ownerUsername, isSignedIn, username} = this.props; + if (!loaded) { + return ; + } + return (