added login redirect

This commit is contained in:
Carter 2025-06-18 16:17:27 -06:00
parent e9dce3abc3
commit 2a020eb6e7
5 changed files with 127 additions and 21 deletions

View file

@ -9,6 +9,7 @@ import { getWhitelabel } from "services/whiteLabel";
import Ventilation from "pages/VentEditor";
import { useGlobalState } from "providers";
import DeviceSupport from "pages/DeviceSupport";
import Login from "pages/Login";
const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
const DevicePage = lazy(() => import("pages/Device"));
@ -283,12 +284,12 @@ export default function Router() {
};
if (isLoading) return null;
if (!isAuthenticated) {
loginWithRedirect()
return (
null
)
}
// if (!isAuthenticated) {
// loginWithRedirect()
// return (
// null
// )
// }
function ErrorFallback({ error }: { error: Error }) {
return <div>Something went wrong: {error.stack}</div>;
@ -302,6 +303,7 @@ export default function Router() {
{/* Redirects */}
<Route path="/callback" element={<Navigate to="/" />} />
<Route path="/login" element={<Login />} />
{/* <Route path="/team/:teamID" element={<Navigate to="/teams/:teamID" />} /> */}
{/* <Route path="/device/:deviceID" element={<Navigate to="/devices/:devicesID" />} /> */}
<Route path="" element={<Navigate to={whiteLabel.homePage ? whiteLabel.homePage : "/devices"} />} />