Merge branch 'master' into ticket/TURNIERE-236

This commit is contained in:
betanummeric 2019-06-18 21:27:26 +02:00 committed by GitHub
commit 34f4eb9fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -184,7 +184,7 @@ const reducerTournamentinfo = (state = defaultStateTournamentinfo, action) => {
case actionTypesTournamentinfo.CREATE_TOURNAMENT: case actionTypesTournamentinfo.CREATE_TOURNAMENT:
postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => { postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => {
storeOptionalToken(resp); storeOptionalToken(resp);
action.parameters.successCallback(); action.parameters.successCallback(resp.data);
}).catch(error => { }).catch(error => {
if (error.response) { if (error.response) {
storeOptionalToken(error.response); storeOptionalToken(error.response);

View File

@ -21,6 +21,7 @@ import {Footer} from '../js/components/Footer';
import EditableStringList from '../js/components/EditableStringList'; import EditableStringList from '../js/components/EditableStringList';
import {createTournament} from '../js/api'; import {createTournament} from '../js/api';
import {WarningPopup} from '../js/components/WarningPopup'; import {WarningPopup} from '../js/components/WarningPopup';
import Router from 'next/router';
import '../static/css/everypage.css'; import '../static/css/everypage.css';
import RequireLogin from '../js/components/RequireLogin'; import RequireLogin from '../js/components/RequireLogin';
@ -216,8 +217,8 @@ class CreateTournamentForm extends React.Component {
create() { create() {
if (this.valuesAreCredible()) { if (this.valuesAreCredible()) {
createTournament(this.generateTournamentCreationObject(), () => { createTournament(this.generateTournamentCreationObject(), data => {
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000); Router.push('/t/' + data.id);
}, () => { }, () => {
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000); notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
}); });

View File

@ -38,7 +38,8 @@ function PublicTournaments(props) {
<PublicTournamentsCard/> <PublicTournamentsCard/>
</Container> </Container>
<Container className="pb-5 pt-3"> <Container className="pb-5 pt-3">
<a href='/private' className="btn btn-success shadow">zu den privaten Turnieren</a> <a href='/private' className="btn btn-primary shadow">zu den privaten Turnieren</a>
<a href='/create' className="ml-3 btn btn-success shadow">neues Turnier erstellen</a>
</Container> </Container>
</div>); </div>);
} else { } else {

View File

@ -19,7 +19,7 @@ class PrivateTournamentsPage extends React.Component {
<title>Private Turniere: turnie.re</title> <title>Private Turniere: turnie.re</title>
</Head> </Head>
<TurniereNavigation/> <TurniereNavigation/>
<PrivateTournamentsPageContent/> <PrivateTournamentsPageContent isSignedIn={this.props.isSignedIn}/>
<Footer/> <Footer/>
</div> </div>
</RequireLogin>); </RequireLogin>);
@ -35,13 +35,14 @@ const PrivateTournamentListPage = connect(mapStateToProperties)(PrivateTournamen
export default PrivateTournamentListPage; export default PrivateTournamentListPage;
function PrivateTournamentsPageContent() { function PrivateTournamentsPageContent(props) {
return (<div> return (<div>
<Container className="pt-5"> <Container className="pt-5">
<PrivateTournamentsCard/> <PrivateTournamentsCard/>
</Container> </Container>
<Container className="pb-5 pt-3"> <Container className="pb-5 pt-3">
<a href='/list' className="btn btn-success shadow">zu den öffentlichen Turnieren</a> <a href='/list' className="btn btn-primary shadow">zu den öffentlichen Turnieren</a>
{props.isSignedIn && <a href='/create' className="ml-3 btn btn-success shadow">neues Turnier erstellen</a>}
</Container> </Container>
</div>); </div>);
} }