diff options
author | 2022-07-10 16:07:45 +0200 | |
---|---|---|
committer | 2022-07-11 17:47:53 +0200 | |
commit | fa1a7037b47f2e0114d8abc5a99d29239bd3637b (patch) | |
tree | 83404acf711aa8976dce47950edcca64836e0cd8 /src/stores/RequestStore.ts | |
parent | 6.0.0-nightly.96 [skip ci] (diff) | |
download | ferdium-app-fa1a7037b47f2e0114d8abc5a99d29239bd3637b.tar.gz ferdium-app-fa1a7037b47f2e0114d8abc5a99d29239bd3637b.tar.zst ferdium-app-fa1a7037b47f2e0114d8abc5a99d29239bd3637b.zip |
refactor: local server import/export
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/stores/RequestStore.ts')
-rw-r--r-- | src/stores/RequestStore.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/stores/RequestStore.ts b/src/stores/RequestStore.ts index a964c5d12..59982c05a 100644 --- a/src/stores/RequestStore.ts +++ b/src/stores/RequestStore.ts | |||
@@ -6,7 +6,7 @@ import { Actions } from '../actions/lib/actions'; | |||
6 | import { ApiInterface } from '../api'; | 6 | import { ApiInterface } from '../api'; |
7 | import { Stores } from '../@types/stores.types'; | 7 | import { Stores } from '../@types/stores.types'; |
8 | import CachedRequest from './lib/CachedRequest'; | 8 | import CachedRequest from './lib/CachedRequest'; |
9 | import { LOCAL_PORT } from '../config'; | 9 | import { LOCAL_HOSTNAME, LOCAL_PORT } from '../config'; |
10 | 10 | ||
11 | import TypedStore from './lib/TypedStore'; | 11 | import TypedStore from './lib/TypedStore'; |
12 | 12 | ||
@@ -21,6 +21,8 @@ export default class RequestStore extends TypedStore { | |||
21 | 21 | ||
22 | @observable localServerPort = LOCAL_PORT; | 22 | @observable localServerPort = LOCAL_PORT; |
23 | 23 | ||
24 | @observable localServerToken: string | undefined; | ||
25 | |||
24 | retries: number = 0; | 26 | retries: number = 0; |
25 | 27 | ||
26 | retryDelay: number = ms('2s'); | 28 | retryDelay: number = ms('2s'); |
@@ -45,6 +47,9 @@ export default class RequestStore extends TypedStore { | |||
45 | if (data.port) { | 47 | if (data.port) { |
46 | this.localServerPort = data.port; | 48 | this.localServerPort = data.port; |
47 | } | 49 | } |
50 | if (data.token) { | ||
51 | this.localServerToken = data.token; | ||
52 | } | ||
48 | }); | 53 | }); |
49 | } | 54 | } |
50 | 55 | ||
@@ -56,6 +61,10 @@ export default class RequestStore extends TypedStore { | |||
56 | return this.userInfoRequest.isExecuting || this.servicesRequest.isExecuting; | 61 | return this.userInfoRequest.isExecuting || this.servicesRequest.isExecuting; |
57 | } | 62 | } |
58 | 63 | ||
64 | @computed get localServerOrigin(): string { | ||
65 | return `http://${LOCAL_HOSTNAME}:${this.localServerPort}`; | ||
66 | } | ||
67 | |||
59 | @action _retryRequiredRequests(): void { | 68 | @action _retryRequiredRequests(): void { |
60 | this.userInfoRequest.reload(); | 69 | this.userInfoRequest.reload(); |
61 | this.servicesRequest.reload(); | 70 | this.servicesRequest.reload(); |