UNPKG

@stolostron/multicluster-sdk

Version:

Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.

37 lines 1.85 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCachedHubConfiguration = exports.fetchHubConfiguration = void 0; /* Copyright Contributors to the Open Cluster Management project */ const apiRequests_1 = require("../api/apiRequests"); const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk"); const FLEET_CONFIGURATION_URL = '/hub'; let cachedHubConfiguration = undefined; let fetchPromise = undefined; const fetchHubConfiguration = () => __awaiter(void 0, void 0, void 0, function* () { if (cachedHubConfiguration) { return cachedHubConfiguration; } if (fetchPromise) { return fetchPromise; } fetchPromise = (0, dynamic_plugin_sdk_1.consoleFetchJSON)((0, apiRequests_1.getBackendUrl)() + 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