diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-02 09:19:34 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@framasoft.org> | 2019-12-02 09:19:34 +0100 |
commit | eb8f702c8398b7f51461c8e967c7bc7de3c10c16 (patch) | |
tree | df0ca5bd7804bd0e1bf37d3719ebc85647c69c16 /client/src/app | |
parent | a3ce4ae847b749d4cb2ebebb4134264b7c58dcc5 (diff) | |
download | PeerTube-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.ts | 6 |
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 | |||
12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' | 12 | import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' |
13 | import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' | 13 | import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' |
14 | import { HttpClient } from '@angular/common/http' | 14 | import { HttpClient } from '@angular/common/http' |
15 | import { AuthService } from '@app/core' | ||
15 | import { RestExtractor } from '@app/shared/rest' | 16 | import { RestExtractor } from '@app/shared/rest' |
16 | import { PluginType } from '@shared/models/plugins/plugin.type' | 17 | import { PluginType } from '@shared/models/plugins/plugin.type' |
17 | import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' | 18 | import { 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])) |