Add getAuthHeader client helper
This commit is contained in:
parent
0ea9f463a9
commit
4eca42ffb4
|
@ -271,6 +271,13 @@ export class PluginService implements ClientHook {
|
||||||
return this.authService.isLoggedIn()
|
return this.authService.isLoggedIn()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAuthHeader: () => {
|
||||||
|
if (!this.authService.isLoggedIn()) return undefined
|
||||||
|
|
||||||
|
const value = this.authService.getRequestHeaderValue()
|
||||||
|
return { 'Authorization': value }
|
||||||
|
},
|
||||||
|
|
||||||
notifier: {
|
notifier: {
|
||||||
info: (text: string, title?: string, timeout?: number) => this.notifier.info(text, title, timeout),
|
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),
|
error: (text: string, title?: string, timeout?: number) => this.notifier.error(text, title, timeout),
|
||||||
|
|
|
@ -21,6 +21,8 @@ export type RegisterClientHelpers = {
|
||||||
|
|
||||||
isLoggedIn: () => boolean
|
isLoggedIn: () => boolean
|
||||||
|
|
||||||
|
getAuthHeader: () => { 'Authorization': string } | undefined
|
||||||
|
|
||||||
getSettings: () => Promise<{ [ name: string ]: string }>
|
getSettings: () => Promise<{ [ name: string ]: string }>
|
||||||
|
|
||||||
getServerConfig: () => Promise<ServerConfig>
|
getServerConfig: () => Promise<ServerConfig>
|
||||||
|
|
Loading…
Reference in New Issue