UNPKG

react-application-core

Version:

A react-based application core for the business applications.

53 lines 2.63 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.PrivateRootContainer = void 0; var R = require("ramda"); var React = require("react"); var react_router_dom_1 = require("react-router-dom"); var base_root_container_1 = require("./base-root.container"); var util_1 = require("../../util"); var PrivateRootContainer = /** @class */ (function (_super) { __extends(PrivateRootContainer, _super); function PrivateRootContainer() { return _super !== null && _super.apply(this, arguments) || this; } /** * @stable [16.11.2019] * @returns {JSX.Element} */ PrivateRootContainer.prototype.render = function () { var _this = this; var _a = this.settings.routes, accessDenied = _a.accessDenied, signIn = _a.signIn; return (React.createElement(react_router_dom_1.Route, { render: function () { if (_this.auth.isAuthorized()) { var accessConfiguration = _this.props.accessConfiguration; var Component = _this.props.container; return util_1.ObjectUtils.isObjectNotEmpty(accessConfiguration) && !_this.hasPermission(accessConfiguration) ? React.createElement(react_router_dom_1.Redirect, { to: accessDenied }) : (React.createElement(Component, { routeParams: _this.routeParams, queryParams: _this.queryParams })); } else { var queryParams = _this.queryParams.toString(); return (React.createElement(react_router_dom_1.Redirect, { to: R.isEmpty(queryParams) ? signIn : signIn + "/?" + queryParams })); } } })); }; return PrivateRootContainer; }(base_root_container_1.BaseRootContainer)); exports.PrivateRootContainer = PrivateRootContainer; //# sourceMappingURL=private-root.container.js.map