Merge pull request #46 from turniere/ticket/TURNIERE-237
Add redirect to the tournament after successful creation
This commit is contained in:
commit
a67038e4c6
|
|
@ -182,7 +182,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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue