feat: simple OAuth2 login with JWT token

This commit is contained in:
2025-02-17 22:28:48 +01:00
parent 15c9a64de2
commit 9647e890f6
4 changed files with 9 additions and 22 deletions

View File

@@ -59,6 +59,7 @@ export default function Analysis() {
const [showControlPanel, setShowControlPanel] = useState(false);
const [loading, setLoading] = useState(true);
const auth = useAuthContext();
// Function to generate and fetch the graph image
async function loadImage() {
setLoading(true);
@@ -67,8 +68,7 @@ export default function Analysis() {
setImage(data.image);
setLoading(false);
}).catch((e) => {
const { checkAuth } = useAuthContext();
checkAuth();
auth.doLogin();
})
}
@@ -89,9 +89,6 @@ export default function Analysis() {
}
}
const { user } = useAuthContext()!
console.log(`logged in as ${user.username}`);
return (
<div className="stack column dropdown">
<button onClick={() => setShowControlPanel(!showControlPanel)}>