UNPKG

@arc-publishing/sdk-identity

Version:
37 lines 1.42 kB
import { __assign, __awaiter, __generator } from "tslib"; import { headers } from './constants'; import Identity from './identity'; import JSONResponseHandler from '../serviceHelpers/JSONResponseHandler'; import { isAPIErrorResponse } from '../serviceHelpers/APIErrorResponse'; export function isConfigOptions(object) { return object.signinRecaptcha !== undefined; } export function getConfig() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { if (!Identity._configOptions) { return [2, fetch("".concat(Identity.apiOrigin, "/identity/public/v1/config"), { method: 'GET', cache: 'no-cache', headers: __assign({}, headers) }) .then(JSONResponseHandler) .then(function (json) { if (isAPIErrorResponse(json)) { throw json; } else { Identity._configOptions = json; return json; } })]; } else { return [2, Identity._configOptions]; } return [2]; }); }); } export default getConfig; //# sourceMappingURL=getConfig.js.map