summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-06-16 10:22:47 +0200
committerDavid Lönnhager <david.l@mullvad.net>2021-06-18 11:53:28 +0200
commit5453eece3a53c4cc45c8987a88789e43fb214912 (patch)
treec36308988a46a5125949f47611e7f76cba21c27a /gui/src/main
parent335cc80d9347f43264765a3dd359eda83c782bc8 (diff)
downloadmullvadvpn-5453eece3a53c4cc45c8987a88789e43fb214912.tar.xz
mullvadvpn-5453eece3a53c4cc45c8987a88789e43fb214912.zip
Update account history RPCs
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/daemon-rpc.ts8
-rw-r--r--gui/src/main/index.ts12
2 files changed, 10 insertions, 10 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 04332a4447..8ed75b8885 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -418,13 +418,13 @@ export class DaemonRpc {
}
}
- public async getAccountHistory(): Promise<AccountToken[]> {
+ public async getAccountHistory(): Promise<AccountToken | undefined> {
const response = await this.callEmpty<grpcTypes.AccountHistory>(this.client.getAccountHistory);
- return response.toObject().tokenList;
+ return response.getToken()?.getValue();
}
- public async removeAccountFromHistory(accountToken: AccountToken): Promise<void> {
- await this.callString(this.client.removeAccountFromHistory, accountToken);
+ public async clearAccountHistory(): Promise<void> {
+ await this.callEmpty(this.client.clearAccountHistory);
}
public async getCurrentVersion(): Promise<string> {
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 2b9bc74a0a..d86a6cba53 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -115,7 +115,7 @@ class ApplicationMain {
private quitStage = AppQuitStage.unready;
private accountData?: IAccountData = undefined;
- private accountHistory: AccountToken[] = [];
+ private accountHistory?: AccountToken = undefined;
private tunnelState: TunnelState = { state: 'disconnected' };
private settings: ISettings = {
accountToken: undefined,
@@ -665,7 +665,7 @@ class ApplicationMain {
return daemonEventListener;
}
- private setAccountHistory(accountHistory: AccountToken[]) {
+ private setAccountHistory(accountHistory?: AccountToken) {
this.accountHistory = accountHistory;
if (this.windowController) {
@@ -1128,8 +1128,8 @@ class ApplicationMain {
this.daemonRpc.submitVoucher(voucherCode),
);
- IpcMainEventChannel.accountHistory.handleRemoveItem(async (token: AccountToken) => {
- await this.daemonRpc.removeAccountFromHistory(token);
+ IpcMainEventChannel.accountHistory.handleClear(async () => {
+ await this.daemonRpc.clearAccountHistory();
consumePromise(this.updateAccountHistory());
});
@@ -1162,8 +1162,8 @@ class ApplicationMain {
const reportPath = this.getProblemReportPath(id);
const executable = resolveBin('mullvad-problem-report');
const args = ['collect', '--output', reportPath];
- if (toRedact.length > 0) {
- args.push('--redact', ...toRedact);
+ if (toRedact) {
+ args.push('--redact', toRedact);
}
return new Promise((resolve, reject) => {