diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-05-24 18:09:36 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-05-27 13:37:34 +0100 |
| commit | 0cd424fb094f82029f2a2e34bfd16ee8e5e87b10 (patch) | |
| tree | 010e48f769c5f687daca1499026745eaa7e961ea /app/containers | |
| parent | f0eeffed6cfd055cf1aa1d23d240a0a8ded42466 (diff) | |
| download | mullvadvpn-0cd424fb094f82029f2a2e34bfd16ee8e5e87b10.tar.xz mullvadvpn-0cd424fb094f82029f2a2e34bfd16ee8e5e87b10.zip | |
Migrate to react-router v4 and react-router-redux v5-alpha
Diffstat (limited to 'app/containers')
| -rw-r--r-- | app/containers/AccountPage.js | 5 | ||||
| -rw-r--r-- | app/containers/App.js | 16 | ||||
| -rw-r--r-- | app/containers/ConnectPage.js | 5 | ||||
| -rw-r--r-- | app/containers/LoginPage.js | 3 | ||||
| -rw-r--r-- | app/containers/SelectLocationPage.js | 5 | ||||
| -rw-r--r-- | app/containers/SettingsPage.js | 5 |
6 files changed, 14 insertions, 25 deletions
diff --git a/app/containers/AccountPage.js b/app/containers/AccountPage.js index bc5e3d3b73..5e695e1d4a 100644 --- a/app/containers/AccountPage.js +++ b/app/containers/AccountPage.js @@ -1,5 +1,6 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { push } from 'react-router-redux'; import Account from '../components/Account'; import userActions from '../actions/user'; import { shell } from 'electron'; @@ -13,8 +14,8 @@ const mapDispatchToProps = (dispatch, props) => { const { logout } = bindActionCreators(userActions, dispatch); return { onLogout: () => logout(props.backend), - onClose: () => props.router.push('/settings'), - onViewAccount: () => props.router.push('/settings/account'), + onClose: () => dispatch(push('/settings')), + onViewAccount: () => dispatch(push('/settings/account')), onExternalLink: (type) => shell.openExternal(links[type]) }; }; diff --git a/app/containers/App.js b/app/containers/App.js deleted file mode 100644 index 2b45c8ed12..0000000000 --- a/app/containers/App.js +++ /dev/null @@ -1,16 +0,0 @@ -import React, { Component, PropTypes } from 'react'; - -export default class App extends Component { - static propTypes = { - children: PropTypes.element.isRequired - }; - - render() { - return ( - <div> - {this.props.children} - </div> - ); - } -} - diff --git a/app/containers/ConnectPage.js b/app/containers/ConnectPage.js index 5f7067b709..fdcc9463af 100644 --- a/app/containers/ConnectPage.js +++ b/app/containers/ConnectPage.js @@ -1,5 +1,6 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { push } from 'react-router-redux'; import { shell } from 'electron'; import { links } from '../config'; import Connect from '../components/Connect'; @@ -14,8 +15,8 @@ const mapDispatchToProps = (dispatch, props) => { const { backend } = props; return { - onSettings: () => props.router.push('/settings'), - onSelectLocation: () => props.router.push('/select-location'), + onSettings: () => dispatch(push('/settings')), + onSelectLocation: () => dispatch(push('/select-location')), onConnect: (addr) => connect(backend, addr), onCopyIP: () => copyIPAddress(), onDisconnect: () => disconnect(backend), diff --git a/app/containers/LoginPage.js b/app/containers/LoginPage.js index 571156ecb2..f5a75ca989 100644 --- a/app/containers/LoginPage.js +++ b/app/containers/LoginPage.js @@ -1,6 +1,7 @@ import { shell } from 'electron'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { push } from 'react-router-redux'; import Login from '../components/Login'; import userActions from '../actions/user'; import { LoginState } from '../enums'; @@ -11,7 +12,7 @@ const mapDispatchToProps = (dispatch, props) => { const { loginChange, login } = bindActionCreators(userActions, dispatch); const { backend } = props; return { - onSettings: () => props.router.push('/settings'), + onSettings: () => dispatch(push('/settings')), onLogin: (account) => login(backend, account), onChange: (account) => loginChange({ account }), onFirstChangeAfterFailure: () => loginChange({ status: LoginState.none, error: null }), diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js index 81fbcfe203..462ffd7bb4 100644 --- a/app/containers/SelectLocationPage.js +++ b/app/containers/SelectLocationPage.js @@ -1,5 +1,6 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { push } from 'react-router-redux'; import SelectLocation from '../components/SelectLocation'; import settingsActions from '../actions/settings'; @@ -8,11 +9,11 @@ const mapDispatchToProps = (dispatch, props) => { const { backend } = props; const settings = bindActionCreators(settingsActions, dispatch); return { - onClose: () => props.router.push('/connect'), + onClose: () => dispatch(push('/connect')), onSelect: (preferredServer) => { const server = backend.serverInfo(preferredServer); - props.router.push('/connect'); + dispatch(push('/connect')); // add delay to let the map load setTimeout(() => { diff --git a/app/containers/SettingsPage.js b/app/containers/SettingsPage.js index fa1a98a44b..b0bc7868b0 100644 --- a/app/containers/SettingsPage.js +++ b/app/containers/SettingsPage.js @@ -1,5 +1,6 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import { push } from 'react-router-redux'; import Settings from '../components/Settings'; import userActions from '../actions/user'; import settingsActions from '../actions/settings'; @@ -16,8 +17,8 @@ const mapDispatchToProps = (dispatch, props) => { return { onQuit: () => remote.app.quit(), onLogout: () => logout(props.backend), - onClose: () => props.router.push('/connect'), - onViewAccount: () => props.router.push('/settings/account'), + onClose: () => dispatch(push('/connect')), + onViewAccount: () => dispatch(push('/settings/account')), onExternalLink: (type) => shell.openExternal(links[type]), onUpdateSettings: updateSettings }; |
