@renderforest/rf-ui-library
Version:
Renderforest UI Library
1 lines • 1.14 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CSRFApi=void 0,exports.SubscriptionsApi=SubscriptionsApi,exports.UpgradePreviewApi=UpgradePreviewApi,exports.UpgradePlanApi=UpgradePlanApi;var _ApiFactory=require("./ApiFactory"),_ApiFactory2=_interopRequireDefault(_ApiFactory),_consts=require("../consts");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function SubscriptionsApi(){return new _ApiFactory2["default"]({path:"".concat(_consts.API_URL_SUBSCRIPTIONS)})}function UpgradePreviewApi(previewPlanId){return new _ApiFactory2["default"]({path:"".concat(_consts.UPGRADE_PREVIEW_API,"/").concat(previewPlanId)})}function UpgradePlanApi(upgradeId){return new _ApiFactory2["default"]({path:"".concat(_consts.UPGRADE_PLAN_USER_API,"/").concat(upgradeId)})}var CSRFApi=exports.CSRFApi=function(){return fetch("".concat(_consts.CSRF_API),{credentials:"include"}).then(function(response){return response.json()}).then(function(data){var status=data.status,message=data.message;if(400<=status||"error"===status)throw new Error("API call failed. ".concat(message));return data})};