aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-22 11:29:06 +0200
committerChocobozzz <me@florianbigard.com>2021-04-22 11:29:06 +0200
commit4eca42ffb4a1f17779d931b84da96ef8d9b3997e (patch)
tree6d6d46627aeb008f50c7287023281bdae4e22970 /client/src
parent0ea9f463a9dc642ec44af4887b97e9dd63b323ef (diff)
downloadPeerTube-4eca42ffb4a1f17779d931b84da96ef8d9b3997e.tar.gz
PeerTube-4eca42ffb4a1f17779d931b84da96ef8d9b3997e.tar.zst
PeerTube-4eca42ffb4a1f17779d931b84da96ef8d9b3997e.zip
Add getAuthHeader client helper
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts7
-rw-r--r--client/src/types/register-client-option.model.ts2
2 files changed, 9 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index ee80d4d39..6a1a46e73 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -271,6 +271,13 @@ export class PluginService implements ClientHook {
271 return this.authService.isLoggedIn() 271 return this.authService.isLoggedIn()
272 }, 272 },
273 273
274 getAuthHeader: () => {
275 if (!this.authService.isLoggedIn()) return undefined
276
277 const value = this.authService.getRequestHeaderValue()
278 return { 'Authorization': value }
279 },
280
274 notifier: { 281 notifier: {
275 info: (text: string, title?: string, timeout?: number) => this.notifier.info(text, title, timeout), 282 info: (text: string, title?: string, timeout?: number) => this.notifier.info(text, title, timeout),
276 error: (text: string, title?: string, timeout?: number) => this.notifier.error(text, title, timeout), 283 error: (text: string, title?: string, timeout?: number) => this.notifier.error(text, title, timeout),
diff --git a/client/src/types/register-client-option.model.ts b/client/src/types/register-client-option.model.ts
index 16c921344..8802edc32 100644
--- a/client/src/types/register-client-option.model.ts
+++ b/client/src/types/register-client-option.model.ts
@@ -21,6 +21,8 @@ export type RegisterClientHelpers = {
21 21
22 isLoggedIn: () => boolean 22 isLoggedIn: () => boolean
23 23
24 getAuthHeader: () => { 'Authorization': string } | undefined
25
24 getSettings: () => Promise<{ [ name: string ]: string }> 26 getSettings: () => Promise<{ [ name: string ]: string }>
25 27
26 getServerConfig: () => Promise<ServerConfig> 28 getServerConfig: () => Promise<ServerConfig>