fix login

This commit is contained in:
Matthias Hochmeister
2026-02-27 14:42:51 +01:00
parent 2a70c274fb
commit 36ffe7e88e
2 changed files with 12 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useAuth } from '../../contexts/AuthContext';
import { Box, CircularProgress, Typography, Alert, Button } from '@mui/material';
@@ -8,8 +8,12 @@ const LoginCallback: React.FC = () => {
const [searchParams] = useSearchParams();
const { login } = useAuth();
const [error, setError] = useState<string>('');
const hasCalledLogin = useRef(false);
useEffect(() => {
if (hasCalledLogin.current) return;
hasCalledLogin.current = true;
const handleCallback = async () => {
const code = searchParams.get('code');
const errorParam = searchParams.get('error');