summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-02-07 15:44:58 +0100
committerOskar Nyberg <oskar@mullvad.net>2022-02-09 12:51:56 +0100
commitce08246ba5ba82f58ce72895d0105d3054026cbb (patch)
treec0aa8ca2f1858d1a8af0cfa9d9392c33161d4f11
parent5d0be2864ca826669681c0cd3bd818629096225e (diff)
downloadmullvadvpn-ce08246ba5ba82f58ce72895d0105d3054026cbb.tar.xz
mullvadvpn-ce08246ba5ba82f58ce72895d0105d3054026cbb.zip
Remove previousExpiry from IAccountData
-rw-r--r--gui/src/main/index.ts8
-rw-r--r--gui/src/renderer/app.tsx11
-rw-r--r--gui/src/renderer/redux/account/actions.ts4
-rw-r--r--gui/src/renderer/redux/account/reducers.ts5
-rw-r--r--gui/src/shared/daemon-rpc-types.ts1
5 files changed, 6 insertions, 23 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 5b7504e711..bb84d520fe 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -230,13 +230,7 @@ class ApplicationMain {
return this.daemonRpc.getAccountData(accountToken);
},
(accountData) => {
- this.accountData = accountData && {
- ...accountData,
- previousExpiry:
- accountData.expiry !== this.accountData?.expiry
- ? this.accountData?.expiry
- : this.accountData?.previousExpiry,
- };
+ this.accountData = accountData;
if (this.windowController) {
IpcMainEventChannel.account.notify(this.windowController.webContents, this.accountData);
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index f5134653a7..e9aadedcc4 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -120,7 +120,7 @@ export default class AppRenderer {
});
IpcRendererEventChannel.account.listen((newAccountData?: IAccountData) => {
- this.setAccountExpiry(newAccountData?.expiry, newAccountData?.previousExpiry);
+ this.setAccountExpiry(newAccountData?.expiry);
});
IpcRendererEventChannel.accountHistory.listen((newAccountHistory?: AccountToken) => {
@@ -199,10 +199,7 @@ export default class AppRenderer {
initialState.translations.relayLocations,
);
- this.setAccountExpiry(
- initialState.accountData?.expiry,
- initialState.accountData?.previousExpiry,
- );
+ this.setAccountExpiry(initialState.accountData?.expiry);
this.setSettings(initialState.settings);
this.handleAccountChange(undefined, initialState.settings.accountToken);
this.setAccountHistory(initialState.accountHistory);
@@ -834,8 +831,8 @@ export default class AppRenderer {
this.reduxActions.settings.updateGuiSettings(guiSettings);
}
- private setAccountExpiry(expiry?: string, previousExpiry?: string) {
- this.reduxActions.account.updateAccountExpiry(expiry, previousExpiry);
+ private setAccountExpiry(expiry?: string) {
+ this.reduxActions.account.updateAccountExpiry(expiry);
}
private storeAutoStart(autoStart: boolean) {
diff --git a/gui/src/renderer/redux/account/actions.ts b/gui/src/renderer/redux/account/actions.ts
index 4a9790df00..b8fbe94d39 100644
--- a/gui/src/renderer/redux/account/actions.ts
+++ b/gui/src/renderer/redux/account/actions.ts
@@ -50,7 +50,6 @@ interface IUpdateAccountHistoryAction {
interface IUpdateAccountExpiryAction {
type: 'UPDATE_ACCOUNT_EXPIRY';
expiry?: string;
- previousExpiry?: string;
}
export type AccountAction =
@@ -133,11 +132,10 @@ function updateAccountHistory(accountHistory?: AccountToken): IUpdateAccountHist
};
}
-function updateAccountExpiry(expiry?: string, previousExpiry?: string): IUpdateAccountExpiryAction {
+function updateAccountExpiry(expiry?: string): IUpdateAccountExpiryAction {
return {
type: 'UPDATE_ACCOUNT_EXPIRY',
expiry,
- previousExpiry,
};
}
diff --git a/gui/src/renderer/redux/account/reducers.ts b/gui/src/renderer/redux/account/reducers.ts
index 6b68fef9cf..53bc55db1b 100644
--- a/gui/src/renderer/redux/account/reducers.ts
+++ b/gui/src/renderer/redux/account/reducers.ts
@@ -10,7 +10,6 @@ export interface IAccountReduxState {
accountToken?: AccountToken;
accountHistory?: AccountToken;
expiry?: string; // ISO8601
- previousExpiry?: string; // ISO8601
status: LoginState;
}
@@ -18,7 +17,6 @@ const initialState: IAccountReduxState = {
accountToken: undefined,
accountHistory: undefined,
expiry: undefined,
- previousExpiry: undefined,
status: { type: 'none' },
};
@@ -50,7 +48,6 @@ export default function (
status: { type: 'none' },
accountToken: undefined,
expiry: undefined,
- previousExpiry: undefined,
};
case 'RESET_LOGIN_ERROR':
return {
@@ -73,7 +70,6 @@ export default function (
status: { type: 'ok', method: 'new_account' },
accountToken: action.token,
expiry: action.expiry,
- previousExpiry: undefined,
};
case 'UPDATE_ACCOUNT_TOKEN':
return {
@@ -89,7 +85,6 @@ export default function (
return {
...state,
expiry: action.expiry,
- previousExpiry: action.previousExpiry,
};
}
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts
index 68e61fc3ea..3abde2ee64 100644
--- a/gui/src/shared/daemon-rpc-types.ts
+++ b/gui/src/shared/daemon-rpc-types.ts
@@ -1,6 +1,5 @@
export interface IAccountData {
expiry: string;
- previousExpiry?: string;
}
export type AccountToken = string;
export type Ip = string;