diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-13 16:39:16 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-13 16:39:16 +0000 |
| commit | 91c10ffcf4c0577507970d71f1d21f4a7de51196 (patch) | |
| tree | 219391f63056dd7e3495a9decd57663a0a454650 /app/lib | |
| parent | 958f44741b463ba1437826e91da7c75c44cc28b9 (diff) | |
| download | mullvadvpn-91c10ffcf4c0577507970d71f1d21f4a7de51196.tar.xz mullvadvpn-91c10ffcf4c0577507970d71f1d21f4a7de51196.zip | |
Simulate login
Diffstat (limited to 'app/lib')
| -rw-r--r-- | app/lib/backend.js | 6 | ||||
| -rw-r--r-- | app/lib/enum.js | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index 33194c4325..7cd5c0af1f 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -28,7 +28,11 @@ class BackendImpl { return new Promise((resolve, reject) => { // @TODO: Add login call setTimeout(() => { - reject(new Error("Invalid account number.")); + if(account.startsWith('1111')) { + resolve(true); + } else { + reject(new Error("Invalid account number.")); + } }, 2000); }); } diff --git a/app/lib/enum.js b/app/lib/enum.js new file mode 100644 index 0000000000..bc8e4b54aa --- /dev/null +++ b/app/lib/enum.js @@ -0,0 +1,20 @@ +import assert from 'assert'; + +/** + * Creates enum object with keys provided as arguments + */ +export default function Enum() { + let object = {}; + + for(const key of arguments) { + Object.defineProperty(object, key, { + enumerable: true, + value: key, + writable: false + }); + } + + Object.freeze(object); + + return object; +}; |
