1
0
Fork 0

Correctly cache server translations

This commit is contained in:
Chocobozzz 2018-08-16 11:57:01 +02:00
parent c0ffdd0958
commit 4bda2e47bb

View file

@ -1,4 +1,4 @@
import { map, share, switchMap, tap } from 'rxjs/operators'
import { map, shareReplay, switchMap, tap } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Inject, Injectable, LOCALE_ID } from '@angular/core'
import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
@ -178,13 +178,13 @@ export class ServerService {
// Default locale, nothing to translate
if (isDefaultLocale(completeLocale)) {
this.localeObservable = of({}).pipe(share())
this.localeObservable = of({}).pipe(shareReplay())
return
}
this.localeObservable = this.http
.get(ServerService.BASE_LOCALE_URL + completeLocale + '/server.json')
.pipe(share())
.pipe(shareReplay())
}
private saveConfigLocally (config: ServerConfig) {