remove updateRouter action

This commit is contained in:
Sérgio Ramos 2017-02-24 13:28:41 +00:00
parent 1dc5f6ec7f
commit 5ec91c7275
5 changed files with 28 additions and 54 deletions

View File

@ -1,8 +1,6 @@
import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Switch, Route } from 'react-router-dom'; import { Switch, Route } from 'react-router-dom';
import { injectGlobal } from 'styled-components'; import { injectGlobal } from 'styled-components';
import { updateRouter } from '@state/actions';
import Article from '@components/article'; import Article from '@components/article';
import Base, { global } from '@ui/components/base'; import Base, { global } from '@ui/components/base';
import BaselineGrid from '@ui/components/baseline-grid'; import BaselineGrid from '@ui/components/baseline-grid';
@ -12,25 +10,13 @@ import Home from '@containers/home';
import NotFound from '@containers/not-found'; import NotFound from '@containers/not-found';
import Nav from '@components/navigation'; import Nav from '@components/navigation';
import OrgNavigation from '@components/navigation/org'; import OrgNavigation from '@components/navigation/org';
import React from 'react';
const App = connect()(React.createClass({ const App = connect()(React.createClass({
displayName: 'App',
propTypes: { propTypes: {
children: React.PropTypes.node, children: React.PropTypes.node
dispatch: React.PropTypes.func,
router: React.PropTypes.object
}, },
componentWillMount: function() { componentWillMount: function() {
const {
router,
dispatch
} = this.props;
// ugly hack needed because of a limitation of react-router api
// that doens't pass it's instance to matched routes
// wait for react-router-redux@5
dispatch(updateRouter(router));
injectGlobal` injectGlobal`
${global} ${global}
`; `;

View File

@ -36,8 +36,6 @@ export const orgRemoveMember =
/*********************************** OTHER ***********************************/ /*********************************** OTHER ***********************************/
export const updateRouter =
createAction(`${APP}/UPDATE_ROUTER`);
export const toggleHeaderTooltip = export const toggleHeaderTooltip =
createAction(`${APP}/TOGGLE_HEADER_TOOLTIP`); createAction(`${APP}/TOGGLE_HEADER_TOOLTIP`);
export const toggleServiceCollapsed = export const toggleServiceCollapsed =

View File

@ -1,11 +0,0 @@
import { handleActions } from 'redux-actions';
import { updateRouter } from '@state/actions';
export default handleActions({
[updateRouter.toString()]: (state, action) => {
return {
...state,
router: action.payload
};
}
}, {});

View File

@ -2,7 +2,6 @@ import { combineReducers } from 'redux';
import { reducer as form } from 'redux-form'; import { reducer as form } from 'redux-form';
import account from '@state/reducers/account'; import account from '@state/reducers/account';
import app from '@state/reducers/app';
import instances from '@state/reducers/instances'; import instances from '@state/reducers/instances';
import intl from '@state/reducers/intl'; import intl from '@state/reducers/intl';
import metrics from '@state/reducers/metrics'; import metrics from '@state/reducers/metrics';
@ -15,7 +14,7 @@ import members from '@state/reducers/members';
export default () => { export default () => {
return combineReducers({ return combineReducers({
account, account,
app, app: (state = {}) => state,
datacenters: (state = {}) => state, datacenters: (state = {}) => state,
form, form,
instances, instances,

View File

@ -1,25 +1,27 @@
const ReduxAva = require('redux-ava'); // const ReduxAva = require('redux-ava');
const test = require('ava'); const test = require('ava');
//
// const actions = require('@state/actions');
//
// const {
// actionTest
// } = ReduxAva;
//
// const {
// updateRouter
// } = actions;
const actions = require('@state/actions'); test('test action', (t) => t.deepEqual(1, 1));
//
const { // test('updateRouter action', actionTest(updateRouter, {
actionTest // type: '/UPDATE_ROUTER'
} = ReduxAva; // }));
//
const { // test('updateRouter action', actionTest(updateRouter, {
updateRouter // transitionTo: '[Function]'
} = actions; // }, {
// type: '/UPDATE_ROUTER',
test('updateRouter action', actionTest(updateRouter, { // payload: {
type: '/UPDATE_ROUTER' // transitionTo: '[Function]'
})); // }
// }));
test('updateRouter action', actionTest(updateRouter, {
transitionTo: '[Function]'
}, {
type: '/UPDATE_ROUTER',
payload: {
transitionTo: '[Function]'
}
}));