1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00

fix cancel add/create toggle

This commit is contained in:
ivaosthu 2016-10-25 22:22:12 +02:00
parent c867d602e8
commit e39e319ed4
3 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,6 @@
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';
import { createFeatureToggles } from '../../store/feature-actions';
import AddComponent from './add-component';
@ -17,9 +19,9 @@ const prepare = (methods, dispatch) => {
}
);
methods.onCancel = () => {
debugger;
window.history.back();
methods.onCancel = (evt) => {
evt.preventDefault();
hashHistory.push('/features');
};
methods.addStrategy = (v) => {

View File

@ -1,4 +1,5 @@
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';
import { requestUpdateFeatureToggle } from '../../store/feature-actions';
import AddComponent from './add-component';
@ -39,8 +40,9 @@ const prepare = (methods, dispatch) => {
}
);
methods.onCancel = () => {
window.history.back();
methods.onCancel = (evt) => {
evt.preventDefault();
hashHistory.push('/features');
};
methods.addStrategy = (v) => {

View File

@ -1,7 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRedirect, useRouterHistory } from 'react-router';
import { createHashHistory } from 'history';
import { Router, Route, IndexRedirect, hashHistory } from 'react-router';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import { createStore, applyMiddleware } from 'redux';
@ -17,8 +16,6 @@ import CreateStrategies from './page/strategies/create';
import HistoryPage from './page/history';
import Archive from './page/archive';
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false });
const unleashStore = createStore(
store,
applyMiddleware(
@ -28,7 +25,7 @@ const unleashStore = createStore(
ReactDOM.render(
<Provider store={unleashStore}>
<Router history={appHistory}>
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRedirect to="/features" />
<Route path="/features" component={Features} />