fix login
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user