"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.Logout = void 0;
var _react = _interopRequireWildcard(require("react"));
var _userContext = require("../../../context/user/userContext");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
//import { useNavigate } from "react-router-dom";
const Logout = _ref => {
  let {
    brandCode
  } = _ref;
  const {
    state,
    logout
  } = (0, _react.useContext)(_userContext.UserContext);
  //const navigate = useNavigate();
  (0, _react.useEffect)(() => {
    var _state$user;
    let url = null;
    if ((state === null || state === void 0 || (_state$user = state.user) === null || _state$user === void 0 || (_state$user = _state$user.userProfile) === null || _state$user === void 0 ? void 0 : _state$user.isSelf) === true) {
      url = process.env.REACT_APP_BASE_URL + "RAPLogOut";
    } else {
      url = process.env.REACT_APP_GENERIC_APP_URL + "User/Login";
    }
    //logout(false);
    window.location.replace(url);
  }, [logout, state]);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: "overlay-loading"
  });
};
exports.Logout = Logout;
var _default = exports.default = Logout;