@stolostron/multicluster-sdk
Version:
Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.
28 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCachedHubConfiguration = exports.fetchHubConfiguration = void 0;
/* Copyright Contributors to the Open Cluster Management project */
const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
const constants_1 = require("./constants");
const FLEET_CONFIGURATION_URL = '/hub';
let cachedHubConfiguration = undefined;
let fetchPromise = undefined;
const fetchHubConfiguration = async () => {
if (cachedHubConfiguration) {
return cachedHubConfiguration;
}
if (fetchPromise) {
return fetchPromise;
}
fetchPromise = (0, dynamic_plugin_sdk_1.consoleFetchJSON)(constants_1.BACKEND_URL + FLEET_CONFIGURATION_URL, 'GET').then((hc) => {
cachedHubConfiguration = hc;
return hc;
});
return fetchPromise;
};
exports.fetchHubConfiguration = fetchHubConfiguration;
const getCachedHubConfiguration = () => {
return cachedHubConfiguration;
};
exports.getCachedHubConfiguration = getCachedHubConfiguration;
//# sourceMappingURL=cachedHubConfiguration.js.map