import type { User } from 'oidc-client-ts'; import { useEffect, useState } from 'react'; import './App.css'; import { getUser, handleCallback, login, logout } from './auth/authService'; 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); }, []); return ( <>

React + Authentik OIDC

{user ? (

Welcome, {user.profile.email}!

) : ( )}
{/*
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