diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-12-08 12:33:02 -0200 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-12-11 12:37:25 -0200 |
| commit | 6cc5b2badae95ed840bfad3c1ba3a17efa82608a (patch) | |
| tree | 38e32ace90554b31b388d6acd55a8a30c2de9745 | |
| parent | 906c6d79840dfe96e446000f9a68824127d247cf (diff) | |
| download | mullvadvpn-6cc5b2badae95ed840bfad3c1ba3a17efa82608a.tar.xz mullvadvpn-6cc5b2badae95ed840bfad3c1ba3a17efa82608a.zip | |
Use `AccountExpiry` helper in `Connect` component
| -rw-r--r-- | gui/packages/desktop/src/renderer/components/Connect.js | 7 | ||||
| -rw-r--r-- | gui/packages/desktop/src/renderer/containers/ConnectPage.js | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/gui/packages/desktop/src/renderer/components/Connect.js b/gui/packages/desktop/src/renderer/components/Connect.js index 507171e372..852d7c053a 100644 --- a/gui/packages/desktop/src/renderer/components/Connect.js +++ b/gui/packages/desktop/src/renderer/components/Connect.js @@ -1,6 +1,5 @@ // @flow -import moment from 'moment'; import * as React from 'react'; import { Component, View } from 'reactxp'; import { SettingsBarButton, Brand, HeaderBarStyle, ImageView } from '@mullvad/components'; @@ -13,13 +12,14 @@ import styles from './ConnectStyles'; import { NoCreditError, NoInternetError } from '../../main/errors'; import type { RelayOutAddress, RelayInAddress } from './TunnelControl'; +import type AccountExpiry from '../lib/account-expiry'; import type { ConnectionReduxState } from '../redux/connection/reducers'; import type { VersionReduxState } from '../redux/version/reducers'; type Props = { connection: ConnectionReduxState, version: VersionReduxState, - accountExpiry: ?string, + accountExpiry: ?AccountExpiry, selectedRelayName: string, connectionInfoOpen: boolean, blockWhenDisconnected: boolean, @@ -240,8 +240,7 @@ export default class Connect extends Component<Props> { } // No credit? - const expiry = this.props.accountExpiry; - if (expiry && moment(expiry).isSameOrBefore(moment())) { + if (this.props.accountExpiry && this.props.accountExpiry.hasExpired()) { return new NoCreditError(); } diff --git a/gui/packages/desktop/src/renderer/containers/ConnectPage.js b/gui/packages/desktop/src/renderer/containers/ConnectPage.js index 77b8109b4f..f433a795e2 100644 --- a/gui/packages/desktop/src/renderer/containers/ConnectPage.js +++ b/gui/packages/desktop/src/renderer/containers/ConnectPage.js @@ -7,6 +7,7 @@ import { bindActionCreators } from 'redux'; import { push } from 'connected-react-router'; import { links } from '../../config'; import Connect from '../components/Connect'; +import AccountExpiry from '../lib/account-expiry'; import userInterfaceActions from '../redux/userinterface/actions'; import type { ReduxState, ReduxDispatch } from '../redux/store'; @@ -58,7 +59,7 @@ function getRelayName( const mapStateToProps = (state: ReduxState) => { return { - accountExpiry: state.account.expiry, + accountExpiry: state.account.expiry ? new AccountExpiry(state.account.expiry) : null, selectedRelayName: getRelayName(state.settings.relaySettings, state.settings.relayLocations), connection: state.connection, version: state.version, |
