From 4eca42ffb4a1f17779d931b84da96ef8d9b3997e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Apr 2021 11:29:06 +0200 Subject: Add getAuthHeader client helper --- client/src/app/core/plugins/plugin.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'client/src/app/core') 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 { return this.authService.isLoggedIn() }, + getAuthHeader: () => { + if (!this.authService.isLoggedIn()) return undefined + + const value = this.authService.getRequestHeaderValue() + return { 'Authorization': value } + }, + notifier: { info: (text: string, title?: string, timeout?: number) => this.notifier.info(text, title, timeout), error: (text: string, title?: string, timeout?: number) => this.notifier.error(text, title, timeout), -- cgit v1.2.3