import { useKeycloak } from "@react-keycloak/web";

export function WithAuth(props) {
  const { keycloak } = useKeycloak();

  const login = async () => {
    await keycloak.login();
  }

  if (keycloak.authenticated) {
    return <>{props.children}</>;
  } else {
    login()
  }

  return <></>;
}
