mirror of https://github.com/apache/druid.git
customHeader (#7456)
This commit is contained in:
parent
3854cfd15e
commit
07eb2effe9
|
@ -39,6 +39,8 @@ import './console-application.scss';
|
|||
export interface ConsoleApplicationProps extends React.Props<any> {
|
||||
hideLegacy: boolean;
|
||||
baseURL?: string;
|
||||
customHeaderName?: string;
|
||||
customHeaderValue?: string;
|
||||
}
|
||||
|
||||
export interface ConsoleApplicationState {
|
||||
|
@ -99,6 +101,9 @@ export class ConsoleApplication extends React.Component<ConsoleApplicationProps,
|
|||
if (props.baseURL) {
|
||||
axios.defaults.baseURL = props.baseURL;
|
||||
}
|
||||
if (props.customHeaderName && props.customHeaderValue) {
|
||||
axios.defaults.headers.common[props.customHeaderName] = props.customHeaderValue;
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(): void {
|
||||
|
|
|
@ -30,17 +30,26 @@ const container = document.getElementsByClassName('app-container')[0];
|
|||
if (!container) throw new Error('container not found');
|
||||
|
||||
interface ConsoleConfig {
|
||||
title?: string;
|
||||
hideLegacy?: boolean;
|
||||
baseURL?: string;
|
||||
customHeaderName?: string;
|
||||
customHeaderValue?: string;
|
||||
}
|
||||
|
||||
const consoleConfig: ConsoleConfig = (window as any).consoleConfig;
|
||||
if (typeof consoleConfig.title === 'string') {
|
||||
window.document.title = consoleConfig.title;
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
React.createElement(
|
||||
ConsoleApplication,
|
||||
{
|
||||
hideLegacy: Boolean(consoleConfig.hideLegacy),
|
||||
baseURL: consoleConfig.baseURL
|
||||
baseURL: consoleConfig.baseURL,
|
||||
customHeaderName: consoleConfig.customHeaderName,
|
||||
customHeaderValue: consoleConfig.customHeaderValue
|
||||
}
|
||||
) as any,
|
||||
container
|
||||
|
|
Loading…
Reference in New Issue