refactor: http service (#2233)

This commit is contained in:
Mo
2023-02-28 20:43:25 -06:00
committed by GitHub
parent 6e7618b258
commit e7f1d35341
142 changed files with 1116 additions and 1307 deletions

View File

@@ -18,7 +18,7 @@ import { SNApiService } from '@Lib/Services/Api/ApiService'
import { ContentType } from '@standardnotes/common'
import { ItemManager } from '../Items/ItemManager'
import { removeFromArray, Uuids } from '@standardnotes/utils'
import { ClientDisplayableError, KeyParamsResponse } from '@standardnotes/responses'
import { ClientDisplayableError, isErrorResponse } from '@standardnotes/responses'
import {
AlertService,
AbstractService,
@@ -283,7 +283,7 @@ export class SNKeyRecoveryService extends AbstractService<KeyRecoveryEvent, Decr
const signInResponse = await this.userService.correctiveSignIn(rootKey)
if (!signInResponse.error) {
if (!isErrorResponse(signInResponse)) {
void this.alertService.alert(KeyRecoveryStrings.KeyRecoveryRootKeyReplaced)
return rootKey
@@ -335,8 +335,8 @@ export class SNKeyRecoveryService extends AbstractService<KeyRecoveryEvent, Decr
email: identifier,
})
if (!paramsResponse.error && paramsResponse.data) {
return KeyParamsFromApiResponse(paramsResponse as KeyParamsResponse)
if (!isErrorResponse(paramsResponse)) {
return KeyParamsFromApiResponse(paramsResponse.data)
} else {
return undefined
}