diff options
author | 2022-07-07 09:31:50 +0200 | |
---|---|---|
committer | 2022-07-07 09:31:50 +0200 | |
commit | 71c52373f81cace664047edd19d9d289f45a4dff (patch) | |
tree | 69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/models | |
parent | 6.0.0-nightly.91 [skip ci] (diff) | |
download | ferdium-app-71c5237.tar.gz ferdium-app-71c5237.tar.zst ferdium-app-71c5237.zip |
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/Service.ts | 4 | ||||
-rw-r--r-- | src/models/User.ts | 4 | ||||
-rw-r--r-- | src/models/UserAgent.ts | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/models/Service.ts b/src/models/Service.ts index 35d573cab..92b8ee64c 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { autorun, computed, observable } from 'mobx'; | 1 | import { autorun, computed, makeObservable, observable } from 'mobx'; |
2 | import { ipcRenderer } from 'electron'; | 2 | import { ipcRenderer } from 'electron'; |
3 | import { webContents } from '@electron/remote'; | 3 | import { webContents } from '@electron/remote'; |
4 | import normalizeUrl from 'normalize-url'; | 4 | import normalizeUrl from 'normalize-url'; |
@@ -132,6 +132,8 @@ export default class Service { | |||
132 | throw new Error('Service recipe not valid'); | 132 | throw new Error('Service recipe not valid'); |
133 | } | 133 | } |
134 | 134 | ||
135 | makeObservable(this); | ||
136 | |||
135 | this.recipe = recipe; | 137 | this.recipe = recipe; |
136 | 138 | ||
137 | this.userAgentModel = new UserAgent(recipe.overrideUserAgent); | 139 | this.userAgentModel = new UserAgent(recipe.overrideUserAgent); |
diff --git a/src/models/User.ts b/src/models/User.ts index 14481fbb6..6540a14e9 100644 --- a/src/models/User.ts +++ b/src/models/User.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { observable } from 'mobx'; | 1 | import { makeObservable, observable } from 'mobx'; |
2 | 2 | ||
3 | interface IUser { | 3 | interface IUser { |
4 | id: string | null; | 4 | id: string | null; |
@@ -42,6 +42,8 @@ export default class User { | |||
42 | @observable team = {}; | 42 | @observable team = {}; |
43 | 43 | ||
44 | constructor(data: IUser) { | 44 | constructor(data: IUser) { |
45 | makeObservable(this); | ||
46 | |||
45 | if (!data) { | 47 | if (!data) { |
46 | throw new Error('User config not valid'); | 48 | throw new Error('User config not valid'); |
47 | } | 49 | } |
diff --git a/src/models/UserAgent.ts b/src/models/UserAgent.ts index 1d06d72b0..d54286ee8 100644 --- a/src/models/UserAgent.ts +++ b/src/models/UserAgent.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { action, computed, observe, observable } from 'mobx'; | 1 | import { action, computed, makeObservable, observable, observe } from 'mobx'; |
2 | 2 | ||
3 | import ElectronWebView from 'react-electron-web-view'; | 3 | import ElectronWebView from 'react-electron-web-view'; |
4 | import defaultUserAgent from '../helpers/userAgent-helpers'; | 4 | import defaultUserAgent from '../helpers/userAgent-helpers'; |
@@ -21,6 +21,8 @@ export default class UserAgent { | |||
21 | @observable overrideUserAgent = (): string => ''; | 21 | @observable overrideUserAgent = (): string => ''; |
22 | 22 | ||
23 | constructor(overrideUserAgent: any = null) { | 23 | constructor(overrideUserAgent: any = null) { |
24 | makeObservable(this); | ||
25 | |||
24 | if (typeof overrideUserAgent === 'function') { | 26 | if (typeof overrideUserAgent === 'function') { |
25 | this.overrideUserAgent = overrideUserAgent; | 27 | this.overrideUserAgent = overrideUserAgent; |
26 | } | 28 | } |