refactor: offline roles (#2169)

This commit is contained in:
Mo
2023-01-19 21:46:21 -06:00
committed by GitHub
parent 391b2af4e1
commit 544a28d450
33 changed files with 282 additions and 266 deletions

View File

@@ -654,7 +654,7 @@ export class SNApiService
public async downloadOfflineFeaturesFromRepo(
repo: SNFeatureRepo,
): Promise<{ features: FeatureDescription[] } | ClientDisplayableError> {
): Promise<{ features: FeatureDescription[]; roles: string[] } | ClientDisplayableError> {
try {
const featuresUrl = repo.offlineFeaturesUrl
const extensionKey = repo.offlineKey
@@ -678,8 +678,10 @@ export class SNApiService
if (response.error) {
return ClientDisplayableError.FromError(response.error)
}
const data = (response as Responses.GetOfflineFeaturesResponse).data
return {
features: (response as Responses.GetOfflineFeaturesResponse).data?.features || [],
features: data?.features || [],
roles: data?.roles || [],
}
} catch {
return new ClientDisplayableError(API_MESSAGE_FAILED_OFFLINE_ACTIVATION)