Add getAuthHeader client helper

pull/4012/head
Chocobozzz 2021-04-22 11:29:06 +02:00
parent 0ea9f463a9
commit 4eca42ffb4
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 9 additions and 0 deletions

View File

@ -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),

View File

@ -21,6 +21,8 @@ export type RegisterClientHelpers = {
isLoggedIn: () => boolean
getAuthHeader: () => { 'Authorization': string } | undefined
getSettings: () => Promise<{ [ name: string ]: string }>
getServerConfig: () => Promise<ServerConfig>