diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-07-06 19:26:35 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-08 13:23:30 +0200 |
| commit | 1592932fe5c09e1f359c63fb25ed9899b356007f (patch) | |
| tree | 29e9d0c193b88ef1f45f54d8a4321e2645382972 /gui/src/renderer/components | |
| parent | 8452dc8559837253b253df7f47a075f156845e66 (diff) | |
| download | mullvadvpn-1592932fe5c09e1f359c63fb25ed9899b356007f.tar.xz mullvadvpn-1592932fe5c09e1f359c63fb25ed9899b356007f.zip | |
Fetch account data when settings and account page is mounted
Diffstat (limited to 'gui/src/renderer/components')
| -rw-r--r-- | gui/src/renderer/components/Account.tsx | 5 | ||||
| -rw-r--r-- | gui/src/renderer/components/Settings.tsx | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gui/src/renderer/components/Account.tsx b/gui/src/renderer/components/Account.tsx index 18980ca1a9..02e2b9f081 100644 --- a/gui/src/renderer/components/Account.tsx +++ b/gui/src/renderer/components/Account.tsx @@ -31,9 +31,14 @@ interface IProps { onLogout: () => void; onClose: () => void; onBuyMore: () => Promise<void>; + updateAccountData: () => void; } export default class Account extends React.Component<IProps> { + public componentDidMount() { + this.props.updateAccountData(); + } + public render() { return ( <ModalContainer> diff --git a/gui/src/renderer/components/Settings.tsx b/gui/src/renderer/components/Settings.tsx index 56b8fd5494..1610f776f9 100644 --- a/gui/src/renderer/components/Settings.tsx +++ b/gui/src/renderer/components/Settings.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { colors, links } from '../../config.json'; import { hasExpired, formatRemainingTime } from '../../shared/account-expiry'; import { messages } from '../../shared/gettext'; +import History from '../lib/history'; import { AriaDescribed, AriaDescription, AriaDescriptionGroup } from './AriaGroup'; import * as Cell from './cell'; import { Layout } from './Layout'; @@ -42,9 +43,17 @@ export interface IProps { onViewPreferences: () => void; onViewAdvancedSettings: () => void; onExternalLink: (url: string) => void; + updateAccountData: () => void; + history: History; } export default class Settings extends React.Component<IProps> { + public componentDidMount() { + if (this.props.history.action === 'PUSH') { + this.props.updateAccountData(); + } + } + public render() { const showLargeTitle = this.props.loginState.type !== 'ok'; |
