diff options
author | muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> | 2022-11-17 05:45:39 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 00:15:39 +0000 |
commit | d9502c7516bc2d4ae467c6ea8a2e4816b0885f37 (patch) | |
tree | b339c587a5529ac26d52cfc12d9972a8a00255e6 /src/stores/UserStore.ts | |
parent | Transform JSX components to TSX (#755) (diff) | |
download | ferdium-app-d9502c7516bc2d4ae467c6ea8a2e4816b0885f37.tar.gz ferdium-app-d9502c7516bc2d4ae467c6ea8a2e4816b0885f37.tar.zst ferdium-app-d9502c7516bc2d4ae467c6ea8a2e4816b0885f37.zip |
Transfrom workspace components to ts (#775)
Diffstat (limited to 'src/stores/UserStore.ts')
-rw-r--r-- | src/stores/UserStore.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/stores/UserStore.ts b/src/stores/UserStore.ts index c5e67c966..6c8f8f20b 100644 --- a/src/stores/UserStore.ts +++ b/src/stores/UserStore.ts | |||
@@ -187,7 +187,7 @@ export default class UserStore extends TypedStore { | |||
187 | 187 | ||
188 | // Actions | 188 | // Actions |
189 | @action async _login({ email, password }): Promise<void> { | 189 | @action async _login({ email, password }): Promise<void> { |
190 | const authToken = await this.loginRequest.execute(email, password)._promise; | 190 | const authToken = await this.loginRequest.execute(email, password).promise; |
191 | this._setUserData(authToken); | 191 | this._setUserData(authToken); |
192 | 192 | ||
193 | this.stores.router.push('/'); | 193 | this.stores.router.push('/'); |
@@ -209,6 +209,8 @@ export default class UserStore extends TypedStore { | |||
209 | plan, | 209 | plan, |
210 | currency, | 210 | currency, |
211 | }): Promise<void> { | 211 | }): Promise<void> { |
212 | // TODO - [TS DEBT] Need to find a way proper to implement promise's then and catch in request class | ||
213 | // @ts-ignore | ||
212 | const authToken = await this.signupRequest.execute({ | 214 | const authToken = await this.signupRequest.execute({ |
213 | firstname, | 215 | firstname, |
214 | lastname, | 216 | lastname, |
@@ -231,14 +233,14 @@ export default class UserStore extends TypedStore { | |||
231 | @action async _retrievePassword({ email }): Promise<void> { | 233 | @action async _retrievePassword({ email }): Promise<void> { |
232 | const request = this.passwordRequest.execute(email); | 234 | const request = this.passwordRequest.execute(email); |
233 | 235 | ||
234 | await request._promise; | 236 | await request.promise; |
235 | this.actionStatus = request.result.status || []; | 237 | this.actionStatus = request.result.status || []; |
236 | } | 238 | } |
237 | 239 | ||
238 | @action async _invite({ invites }): Promise<void> { | 240 | @action async _invite({ invites }): Promise<void> { |
239 | const data = invites.filter(invite => invite.email !== ''); | 241 | const data = invites.filter(invite => invite.email !== ''); |
240 | 242 | ||
241 | const response = await this.inviteRequest.execute(data)._promise; | 243 | const response = await this.inviteRequest.execute(data).promise; |
242 | 244 | ||
243 | this.actionStatus = response.status || []; | 245 | this.actionStatus = response.status || []; |
244 | 246 | ||
@@ -251,8 +253,7 @@ export default class UserStore extends TypedStore { | |||
251 | @action async _update({ userData }): Promise<void> { | 253 | @action async _update({ userData }): Promise<void> { |
252 | if (!this.isLoggedIn) return; | 254 | if (!this.isLoggedIn) return; |
253 | 255 | ||
254 | const response = await this.updateUserInfoRequest.execute(userData) | 256 | const response = await this.updateUserInfoRequest.execute(userData).promise; |
255 | ._promise; | ||
256 | 257 | ||
257 | this.getUserInfoRequest.patch(() => response.data); | 258 | this.getUserInfoRequest.patch(() => response.data); |
258 | this.actionStatus = response.status || []; | 259 | this.actionStatus = response.status || []; |
@@ -299,7 +300,7 @@ export default class UserStore extends TypedStore { | |||
299 | data: service, | 300 | data: service, |
300 | }); | 301 | }); |
301 | // eslint-disable-next-line no-await-in-loop | 302 | // eslint-disable-next-line no-await-in-loop |
302 | await this.stores.services.createServiceRequest._promise; | 303 | await this.stores.services.createServiceRequest.promise; |
303 | } | 304 | } |
304 | 305 | ||
305 | this.isImportLegacyServicesExecuting = false; | 306 | this.isImportLegacyServicesExecuting = false; |
@@ -349,7 +350,7 @@ export default class UserStore extends TypedStore { | |||
349 | if (this.isLoggedIn) { | 350 | if (this.isLoggedIn) { |
350 | let data; | 351 | let data; |
351 | try { | 352 | try { |
352 | data = await this.getUserInfoRequest.execute()._promise; | 353 | data = await this.getUserInfoRequest.execute().promise; |
353 | } catch { | 354 | } catch { |
354 | return; | 355 | return; |
355 | } | 356 | } |
@@ -406,7 +407,7 @@ export default class UserStore extends TypedStore { | |||
406 | 407 | ||
407 | async _migrateUserLocale(): Promise<void> { | 408 | async _migrateUserLocale(): Promise<void> { |
408 | try { | 409 | try { |
409 | await this.getUserInfoRequest._promise; | 410 | await this.getUserInfoRequest.promise; |
410 | } catch { | 411 | } catch { |
411 | return; | 412 | return; |
412 | } | 413 | } |