diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-05-11 18:04:01 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-06-12 14:31:04 +0200 |
| commit | 2b7106e417b62b86c22e8c8a3af487424d60c347 (patch) | |
| tree | 7fed61c4ad317df1f255d2c982970578fa0e134b /gui/src/shared | |
| parent | 601109ac7845bf603e4b2d17bb72f30401706b71 (diff) | |
| download | mullvadvpn-2b7106e417b62b86c22e8c8a3af487424d60c347.tar.xz mullvadvpn-2b7106e417b62b86c22e8c8a3af487424d60c347.zip | |
Replace thrown error in account data fetch with typed values
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 8 | ||||
| -rw-r--r-- | gui/src/shared/ipc-schema.ts | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index f8c9fa5fff..a1997d06ad 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -1,6 +1,14 @@ export interface IAccountData { expiry: string; } + +export type AccountDataError = { + type: 'error'; + error: 'invalid-account' | 'too-many-devices' | 'list-devices' | 'communication'; +}; + +export type AccountDataResponse = ({ type: 'success' } & IAccountData) | AccountDataError; + export type AccountToken = string; export type Ip = string; export interface ILocation { diff --git a/gui/src/shared/ipc-schema.ts b/gui/src/shared/ipc-schema.ts index 1dc7d82701..5a50fa315a 100644 --- a/gui/src/shared/ipc-schema.ts +++ b/gui/src/shared/ipc-schema.ts @@ -2,6 +2,7 @@ import { GetTextTranslations } from 'gettext-parser'; import { ILinuxSplitTunnelingApplication, IWindowsApplication } from './application-types'; import { + AccountDataError, AccountToken, BridgeSettings, BridgeState, @@ -183,7 +184,7 @@ export const ipcSchema = { device: notifyRenderer<DeviceEvent>(), devices: notifyRenderer<Array<IDevice>>(), create: invoke<void, string>(), - login: invoke<AccountToken, void>(), + login: invoke<AccountToken, AccountDataError | undefined>(), logout: invoke<void, void>(), getWwwAuthToken: invoke<void, string>(), submitVoucher: invoke<string, VoucherResponse>(), |
