import type { User } from 'oidc-client-ts'; import { useEffect, useState } from 'react'; import './App.css'; import { getUser, handleCallback, logout } from './auth/authService'; import LoginModal from './components/LoginModal'; import { Map } from './components/Map'; import { Parameters } from './components/Parameters'; function App() { const [listingData, setListingData] = useState({}); const [user, setUser] = useState(null); useEffect(() => { // Check if this is a callback from Authentik (after login) if (window.location.pathname === '/callback') { handleCallback().then(() => { window.location.href = '/'; // Redirect to home after login }); return; } // Load user data getUser().then(setUser); }, []); if (!user) { return } return ( <>

Welcome, {user.profile.name}!

{/*
Vite logo React logo

Vite + React

Edit src/App.tsx and save to test HMR

Click on the Vite and React logos to learn more

*/} {/* */} {Object.keys(listingData).length > 0 &&
} ) } export default App