refactor: http service (#2233)
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
lastElement,
|
||||
isString,
|
||||
} from '@standardnotes/utils'
|
||||
import { ClientDisplayableError, UserFeaturesResponse } from '@standardnotes/responses'
|
||||
import { ClientDisplayableError, isErrorResponse } from '@standardnotes/responses'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { RoleName } from '@standardnotes/domain-core'
|
||||
import { FillItemContent, PayloadEmitSource } from '@standardnotes/models'
|
||||
@@ -417,8 +417,8 @@ export class SNFeaturesService
|
||||
if (shouldDownloadRoleBasedFeatures) {
|
||||
const featuresResponse = await this.apiService.getUserFeatures(userUuid)
|
||||
|
||||
if (!featuresResponse.error && featuresResponse.data && !this.deinited) {
|
||||
const features = (featuresResponse as UserFeaturesResponse).data.features
|
||||
if (!isErrorResponse(featuresResponse) && !this.deinited) {
|
||||
const features = featuresResponse.data.features
|
||||
await this.didDownloadFeatures(features)
|
||||
}
|
||||
}
|
||||
@@ -747,7 +747,7 @@ export class SNFeaturesService
|
||||
|
||||
private async performDownloadExternalFeature(url: string): Promise<Models.SNComponent | undefined> {
|
||||
const response = await this.apiService.downloadFeatureUrl(url)
|
||||
if (response.error) {
|
||||
if (response.data?.error) {
|
||||
await this.alertService.alert(API_MESSAGE_FAILED_DOWNLOADING_EXTENSION)
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user