Initial commit

This commit is contained in:
2026-03-16 22:05:19 +03:00
commit 8e78b8cb47
71 changed files with 7846 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import keycloak from "Api/Keycloak/Keycloak";
import { useEffect, useRef } from "react";
import { Outlet } from "react-router";
export default function AuthGuard() {
const loginStarted = useRef(false);
useEffect(() => {
if (!keycloak.authenticated && !loginStarted.current) {
loginStarted.current = true;
keycloak.login({
redirectUri: window.location.href,
});
}
}, []);
if (!keycloak.authenticated) {
return <div>Redirecting to login...</div>;
}
return <Outlet />;
}