install shadcdn and move login dialog to a separate component
This commit is contained in:
parent
4c7fe8927b
commit
a8ee95b9d9
13 changed files with 1141 additions and 73 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import type { User } from 'oidc-client-ts';
|
||||
import { useEffect, useState } from 'react';
|
||||
import './App.css';
|
||||
import { getUser, handleCallback, login, logout } from './auth/authService';
|
||||
import { getUser, handleCallback, logout } from './auth/authService';
|
||||
import LoginModal from './components/LoginModal';
|
||||
import { Map } from './components/Map';
|
||||
import { Parameters } from './components/Parameters';
|
||||
|
||||
|
|
@ -22,19 +23,16 @@ function App() {
|
|||
getUser().then(setUser);
|
||||
}, []);
|
||||
|
||||
if (!user) {
|
||||
return <LoginModal isOpen={user === null} />
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<h1>React + Authentik OIDC</h1>
|
||||
{user ? (
|
||||
<div>
|
||||
<p>Welcome, {user.profile.email}!</p>
|
||||
<button onClick={logout}>Logout</button>
|
||||
</div>
|
||||
) : (
|
||||
<button onClick={login}>Login with Authentik</button>
|
||||
)}
|
||||
<p>Welcome, {user.profile.name}!</p>
|
||||
<button onClick={logout}>Logout</button>
|
||||
</div>
|
||||
{/* <div>
|
||||
<a href="https://vite.dev" target="_blank">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue