diff options
| -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, |
