import React, { useContext, useEffect } from "react";
import { UserContext } from "../../../context/user/userContext";
//import { useNavigate } from "react-router-dom";
export const Logout = ({ brandCode }) => {
  const { state, logout } = useContext(UserContext);
  //const navigate = useNavigate();
  useEffect(() => {
    let url = null;
    if (state?.user?.userProfile?.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 <div className="overlay-loading"></div>;
};


