import React from "react";
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import App from "@/App";
import { ProtectedRoute, useAuth } from "@features/auth";
import { ComponentDemo, EditPosition } from "@/components";
// Simple login page component
const LoginPage = () => {
const { isAuthenticated, signinRedirect } = useAuth();
// Redirect to main app if already authenticated
if (isAuthenticated) {
return ;
}
return (
App
Please log in to access the application
);
};
// Callback page for handling authentication redirects
const CallbackPage = () => {
const { isLoading, isAuthenticated, error } = useAuth();
if (isLoading) {
return (
);
}
if (error) {
return (
Authentication Error
{error.message}
);
}
// Redirect to main app if authentication was successful
return ;
};
// Main router component
export const AppRouter = () => {
return (
} />
} />
} />
console.log("Saved:", data)}
onCancel={() => window.history.back()}
/>
}
/>
}
/>
);
};