1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30:06 +02:00

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 { Switch, Route } from 'react-router-dom';
import { injectGlobal } from 'styled-components';
import { updateRouter } from '@state/actions';
import Article from '@components/article';
import Base, { global } from '@ui/components/base';
import BaselineGrid from '@ui/components/baseline-grid';
@ -12,25 +10,13 @@ import Home from '@containers/home';
import NotFound from '@containers/not-found';
import Nav from '@components/navigation';
import OrgNavigation from '@components/navigation/org';
import React from 'react';
const App = connect()(React.createClass({
displayName: 'App',
propTypes: {
children: React.PropTypes.node,
dispatch: React.PropTypes.func,
router: React.PropTypes.object
children: React.PropTypes.node
},
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`
${global}
`;

View File

@ -36,8 +36,6 @@ export const orgRemoveMember =
/*********************************** OTHER ***********************************/
export const updateRouter =
createAction(`${APP}/UPDATE_ROUTER`);
export const toggleHeaderTooltip =
createAction(`${APP}/TOGGLE_HEADER_TOOLTIP`);
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 account from '@state/reducers/account';
import app from '@state/reducers/app';
import instances from '@state/reducers/instances';
import intl from '@state/reducers/intl';
import metrics from '@state/reducers/metrics';
@ -15,7 +14,7 @@ import members from '@state/reducers/members';
export default () => {
return combineReducers({
account,
app,
app: (state = {}) => state,
datacenters: (state = {}) => state,
form,
instances,

View File

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