diff options
Diffstat (limited to 'src/features/settingsWS/store.js')
-rwxr-xr-x | src/features/settingsWS/store.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/features/settingsWS/store.js b/src/features/settingsWS/store.js index 9100f33d1..3b9e10825 100755 --- a/src/features/settingsWS/store.js +++ b/src/features/settingsWS/store.js | |||
@@ -4,7 +4,7 @@ import ms from 'ms'; | |||
4 | 4 | ||
5 | import { FeatureStore } from '../utils/FeatureStore'; | 5 | import { FeatureStore } from '../utils/FeatureStore'; |
6 | import { createReactions } from '../../stores/lib/Reaction'; | 6 | import { createReactions } from '../../stores/lib/Reaction'; |
7 | import { WS_API } from '../../environment'; | 7 | import { WS_API } from '../../environment-remote'; |
8 | 8 | ||
9 | const debug = require('debug')('Ferdi:feature:settingsWS:store'); | 9 | const debug = require('debug')('Ferdi:feature:settingsWS:store'); |
10 | 10 | ||
@@ -25,11 +25,13 @@ export class SettingsWSStore extends FeatureStore { | |||
25 | this.stores = stores; | 25 | this.stores = stores; |
26 | this.actions = actions; | 26 | this.actions = actions; |
27 | 27 | ||
28 | this._registerReactions(createReactions([ | 28 | this._registerReactions( |
29 | this._initialize.bind(this), | 29 | createReactions([ |
30 | this._reconnect.bind(this), | 30 | this._initialize.bind(this), |
31 | this._close.bind(this), | 31 | this._reconnect.bind(this), |
32 | ])); | 32 | this._close.bind(this), |
33 | ]), | ||
34 | ); | ||
33 | } | 35 | } |
34 | 36 | ||
35 | connect() { | 37 | connect() { |
@@ -51,12 +53,12 @@ export class SettingsWSStore extends FeatureStore { | |||
51 | this.heartbeat(); | 53 | this.heartbeat(); |
52 | }); | 54 | }); |
53 | 55 | ||
54 | this.ws.on('message', (data) => { | 56 | this.ws.on('message', data => { |
55 | const resp = JSON.parse(data); | 57 | const resp = JSON.parse(data); |
56 | debug('Received message', resp); | 58 | debug('Received message', resp); |
57 | 59 | ||
58 | if (resp.id) { | 60 | if (resp.id) { |
59 | this.stores.user.getUserInfoRequest.patch((result) => { | 61 | this.stores.user.getUserInfoRequest.patch(result => { |
60 | if (!result) return; | 62 | if (!result) return; |
61 | 63 | ||
62 | debug('Patching user object with new values'); | 64 | debug('Patching user object with new values'); |
@@ -66,8 +68,8 @@ export class SettingsWSStore extends FeatureStore { | |||
66 | }); | 68 | }); |
67 | 69 | ||
68 | this.ws.on('ping', this.heartbeat.bind(this)); | 70 | this.ws.on('ping', this.heartbeat.bind(this)); |
69 | } catch (err) { | 71 | } catch (error) { |
70 | console.err(err); | 72 | console.error(error); |
71 | } | 73 | } |
72 | } | 74 | } |
73 | 75 | ||