{"size": 1048, "ext": "js", "max_stars_repo_path": "dist/services/privateRoute.js", "max_stars_repo_name": "iwonakulacz/MSDlib", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/services/privateRoute.js", "max_issues_repo_name": "iwonakulacz/MSDlib", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/services/privateRoute.js", "max_forks_repo_name": "iwonakulacz/MSDlib", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 38.8148148148, "max_line_length": 186, "alphanum_fraction": 0.7080152672}
import _objectWithoutProperties from "/Users/iwonakulacz/Documents/repos/msd-package/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties";

/* eslint-disable react/jsx-props-no-spreading */

/* eslint-disable react/prop-types  */
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
import Auth from './auth';

function PrivateRoute(_ref) {
  var Component = _ref.component,
      _ref$isMyAccount = _ref.isMyAccount,
      isMyAccount = _ref$isMyAccount === void 0 ? false : _ref$isMyAccount,
      rest = _objectWithoutProperties(_ref, ["component", "isMyAccount"]);

  return /*#__PURE__*/React.createElement(Route, Object.assign({}, rest, {
    render: function render(props) {
      return Auth.isLogged() ? /*#__PURE__*/React.createElement(Component, props) : /*#__PURE__*/React.createElement(Redirect, {
        to: {
          pathname: isMyAccount ? Auth.myAccount.loginPage : Auth.checkout.loginPage
        }
      });
    }
  }));
}

export default PrivateRoute;