import React from "react";
import { Navigate } from "react-router-dom";
import {
  // checkModulePermission,
  // checkModulePermission,
  // getPortalType,
  // isCollageId,
  isLoggedIn,
} from "../utils/share";
import NotFound from "../views/NotFound";
// import NotFound from '../views/NotFound';

export const withAuth = (Component, permission, isProtected) => (props) => {
  const isAuthenticated = isLoggedIn();
  if (isProtected && !isAuthenticated) {
    return <Navigate to={"/auth/login"} />;
  }

  // if (!checkModulePermission(permission)) {
  //   return <NotFound />;
  // }

  return <Component {...props} />;
};
