@trap_stevo/legendarybuilderproreact-ui
Version:
The legendary UI & utility API that makes your application a legendary application. ~ Created by Steven Compton
15 lines • 667 B
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["element", "authorized", "redirectPath"];
import React from "react";
import { Navigate } from "react-router-dom";
var HUDProtectedRoute = function HUDProtectedRoute(_ref) {
var Element = _ref.element,
authorized = _ref.authorized,
_ref$redirectPath = _ref.redirectPath,
redirectPath = _ref$redirectPath === void 0 ? "/authentication" : _ref$redirectPath,
rest = _objectWithoutProperties(_ref, _excluded);
return authorized ? Element : /*#__PURE__*/React.createElement(Navigate, {
to: redirectPath
});
};
export default HUDProtectedRoute;