aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2019-12-02 09:19:34 +0100
committerChocobozzz <chocobozzz@framasoft.org>2019-12-02 09:19:34 +0100
commiteb8f702c8398b7f51461c8e967c7bc7de3c10c16 (patch)
treedf0ca5bd7804bd0e1bf37d3719ebc85647c69c16 /client/src/app
parenta3ce4ae847b749d4cb2ebebb4134264b7c58dcc5 (diff)
downloadPeerTube-eb8f702c8398b7f51461c8e967c7bc7de3c10c16.tar.gz
PeerTube-eb8f702c8398b7f51461c8e967c7bc7de3c10c16.tar.zst
PeerTube-eb8f702c8398b7f51461c8e967c7bc7de3c10c16.zip
(plugins) add helper to know if user is logged-in
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 52ba4215a..3f96ef6de 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -12,6 +12,7 @@ import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plu
12import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' 12import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type'
13import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' 13import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model'
14import { HttpClient } from '@angular/common/http' 14import { HttpClient } from '@angular/common/http'
15import { AuthService } from '@app/core'
15import { RestExtractor } from '@app/shared/rest' 16import { RestExtractor } from '@app/shared/rest'
16import { PluginType } from '@shared/models/plugins/plugin.type' 17import { PluginType } from '@shared/models/plugins/plugin.type'
17import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' 18import { PublicServerSetting } from '@shared/models/plugins/public-server.setting'
@@ -58,6 +59,7 @@ export class PluginService implements ClientHook {
58 59
59 constructor ( 60 constructor (
60 private router: Router, 61 private router: Router,
62 private authService: AuthService,
61 private server: ServerService, 63 private server: ServerService,
62 private zone: NgZone, 64 private zone: NgZone,
63 private authHttp: HttpClient, 65 private authHttp: HttpClient,
@@ -266,6 +268,10 @@ export class PluginService implements ClientHook {
266 .toPromise() 268 .toPromise()
267 }, 269 },
268 270
271 isLoggedIn: () => {
272 return this.authService.isLoggedIn()
273 },
274
269 translate: (value: string) => { 275 translate: (value: string) => {
270 return this.translationsObservable 276 return this.translationsObservable
271 .pipe(map(allTranslations => allTranslations[npmName])) 277 .pipe(map(allTranslations => allTranslations[npmName]))