Add redirect to the tournament after successful creation
This commit is contained in:
parent
4f9942e242
commit
f99492c809
|
|
@ -182,7 +182,7 @@ const reducerTournamentinfo = (state = defaultStateTournamentinfo, action) => {
|
|||
case actionTypesTournamentinfo.CREATE_TOURNAMENT:
|
||||
postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => {
|
||||
storeOptionalToken(resp);
|
||||
action.parameters.successCallback();
|
||||
action.parameters.successCallback(resp.data);
|
||||
}).catch(error => {
|
||||
if (error.response) {
|
||||
storeOptionalToken(error.response);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {Footer} from '../js/components/Footer';
|
|||
import EditableStringList from '../js/components/EditableStringList';
|
||||
import {createTournament} from '../js/api';
|
||||
import {WarningPopup} from '../js/components/WarningPopup';
|
||||
import Router from 'next/router';
|
||||
|
||||
import '../static/css/everypage.css';
|
||||
import RequireLogin from '../js/components/RequireLogin';
|
||||
|
|
@ -216,8 +217,8 @@ class CreateTournamentForm extends React.Component {
|
|||
|
||||
create() {
|
||||
if (this.valuesAreCredible()) {
|
||||
createTournament(this.generateTournamentCreationObject(), () => {
|
||||
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000);
|
||||
createTournament(this.generateTournamentCreationObject(), data => {
|
||||
Router.push('/t/' + data.id);
|
||||
}, () => {
|
||||
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue