summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-03-01 16:19:55 +0100
committerAndrej Mihajlov <and@mullvad.net>2019-03-01 16:45:51 +0100
commitac728cbef306c08698c66c3e3f1515e8cb636ea3 (patch)
tree0ac51b0cc92d901ad7c600bbd5ac000d90b1271a /gui
parentd03f0a099846f3ac97b238199e8802e9aa429d06 (diff)
downloadmullvadvpn-ac728cbef306c08698c66c3e3f1515e8cb636ea3.tar.xz
mullvadvpn-ac728cbef306c08698c66c3e3f1515e8cb636ea3.zip
Convert AccountFetchRetryAction to enum
Diffstat (limited to 'gui')
-rw-r--r--gui/src/renderer/app.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 7a671927e1..d039b24a43 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -222,10 +222,10 @@ export default class AppRenderer {
onError: (error): AccountFetchRetryAction => {
if (error instanceof InvalidAccountError) {
reject(error);
- return 'stop';
+ return AccountFetchRetryAction.stop;
} else {
resolve({ status: 'deferred', error });
- return 'retry';
+ return AccountFetchRetryAction.retry;
}
},
});
@@ -538,7 +538,10 @@ export default class AppRenderer {
}
type AccountVerification = { status: 'verified' } | { status: 'deferred'; error: Error };
-type AccountFetchRetryAction = 'stop' | 'retry';
+export enum AccountFetchRetryAction {
+ stop,
+ retry,
+}
interface IAccountFetchWatcher {
onFinish: () => void;
onError: (error: Error) => AccountFetchRetryAction;
@@ -622,7 +625,7 @@ export class AccountDataCache {
let shouldRetry = true;
this.notifyWatchers((watcher) => {
- if (watcher.onError(error) === 'stop') {
+ if (watcher.onError(error) === AccountFetchRetryAction.stop) {
shouldRetry = false;
}
});