From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- client/src/app/core/plugins/plugin.service.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'client/src/app/core/plugins/plugin.service.ts') diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index 16108e17a..774c03964 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts @@ -1,4 +1,4 @@ -import { Observable, of } from 'rxjs' +import { firstValueFrom, Observable, of } from 'rxjs' import { catchError, map, shareReplay } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' @@ -164,18 +164,20 @@ export class PluginService implements ClientHook { getSettings: () => { const path = PluginService.BASE_PLUGIN_API_URL + '/' + npmName + '/public-settings' - return this.authHttp.get(path) + const obs = this.authHttp.get(path) .pipe( map(p => p.publicSettings), catchError(res => this.restExtractor.handleError(res)) ) - .toPromise() + + return firstValueFrom(obs) }, getServerConfig: () => { - return this.server.getConfig() + const obs = this.server.getConfig() .pipe(catchError(res => this.restExtractor.handleError(res))) - .toPromise() + + return firstValueFrom(obs) }, isLoggedIn: () => { @@ -216,10 +218,11 @@ export class PluginService implements ClientHook { }, translate: (value: string) => { - return this.translationsObservable + const obs = this.translationsObservable .pipe(map(allTranslations => allTranslations[npmName])) .pipe(map(translations => peertubeTranslate(value, translations))) - .toPromise() + + return firstValueFrom(obs) } } } -- cgit v1.2.3