mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-21 03:36:18 +00:00
15 lines
603 B
TypeScript
15 lines
603 B
TypeScript
|
import { useEffect, useState } from "react";
|
||
|
import { ConfigContext, initializeConfiguration } from "../ConfigContext";
|
||
|
|
||
|
// This hook initializes global configuration from a config.json file that is injected at deploy time
|
||
|
// This allows the same main Data Explorer build to be exactly the same in all clouds/platforms,
|
||
|
// but override some of the configuration as nesssary
|
||
|
export function useConfig(): Readonly<ConfigContext> {
|
||
|
const [state, setState] = useState<ConfigContext>();
|
||
|
|
||
|
useEffect(() => {
|
||
|
initializeConfiguration().then((response) => setState(response));
|
||
|
}, []);
|
||
|
return state;
|
||
|
}
|