diff options
Diffstat (limited to 'client/src/app/core/plugins/plugin.service.ts')
-rw-r--r-- | client/src/app/core/plugins/plugin.service.ts | 17 |
1 files changed, 10 insertions, 7 deletions
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 @@ | |||
1 | import { Observable, of } from 'rxjs' | 1 | import { firstValueFrom, Observable, of } from 'rxjs' |
2 | import { catchError, map, shareReplay } from 'rxjs/operators' | 2 | import { catchError, map, shareReplay } from 'rxjs/operators' |
3 | import { HttpClient } from '@angular/common/http' | 3 | import { HttpClient } from '@angular/common/http' |
4 | import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' | 4 | import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core' |
@@ -164,18 +164,20 @@ export class PluginService implements ClientHook { | |||
164 | getSettings: () => { | 164 | getSettings: () => { |
165 | const path = PluginService.BASE_PLUGIN_API_URL + '/' + npmName + '/public-settings' | 165 | const path = PluginService.BASE_PLUGIN_API_URL + '/' + npmName + '/public-settings' |
166 | 166 | ||
167 | return this.authHttp.get<PublicServerSetting>(path) | 167 | const obs = this.authHttp.get<PublicServerSetting>(path) |
168 | .pipe( | 168 | .pipe( |
169 | map(p => p.publicSettings), | 169 | map(p => p.publicSettings), |
170 | catchError(res => this.restExtractor.handleError(res)) | 170 | catchError(res => this.restExtractor.handleError(res)) |
171 | ) | 171 | ) |
172 | .toPromise() | 172 | |
173 | return firstValueFrom(obs) | ||
173 | }, | 174 | }, |
174 | 175 | ||
175 | getServerConfig: () => { | 176 | getServerConfig: () => { |
176 | return this.server.getConfig() | 177 | const obs = this.server.getConfig() |
177 | .pipe(catchError(res => this.restExtractor.handleError(res))) | 178 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
178 | .toPromise() | 179 | |
180 | return firstValueFrom(obs) | ||
179 | }, | 181 | }, |
180 | 182 | ||
181 | isLoggedIn: () => { | 183 | isLoggedIn: () => { |
@@ -216,10 +218,11 @@ export class PluginService implements ClientHook { | |||
216 | }, | 218 | }, |
217 | 219 | ||
218 | translate: (value: string) => { | 220 | translate: (value: string) => { |
219 | return this.translationsObservable | 221 | const obs = this.translationsObservable |
220 | .pipe(map(allTranslations => allTranslations[npmName])) | 222 | .pipe(map(allTranslations => allTranslations[npmName])) |
221 | .pipe(map(translations => peertubeTranslate(value, translations))) | 223 | .pipe(map(translations => peertubeTranslate(value, translations))) |
222 | .toPromise() | 224 | |
225 | return firstValueFrom(obs) | ||
223 | } | 226 | } |
224 | } | 227 | } |
225 | } | 228 | } |