fixes
This commit is contained in:
@@ -8,7 +8,7 @@ import { styled } from '@mui/material/styles';
|
|||||||
import NavigateNextRoundedIcon from '@mui/icons-material/NavigateNextRounded';
|
import NavigateNextRoundedIcon from '@mui/icons-material/NavigateNextRounded';
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
import { LatestProps } from "../types/props";
|
import { LatestProps } from "../types/props";
|
||||||
import Fade from '@mui/material/Fade'; // ✅ for smooth appearance
|
import Fade from '@mui/material/Fade';
|
||||||
|
|
||||||
|
|
||||||
const StyledTypography = styled(Typography)({
|
const StyledTypography = styled(Typography)({
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
const res = await api.post('/auth/register', { username, password });
|
const res = await api.post('/auth/register', { username, password });
|
||||||
return res.data; // returns PublicUser from backend
|
return res.data; // returns PublicUser from the backend
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error('Registration failed:', err);
|
console.error('Registration failed:', err);
|
||||||
setError(err.response?.data?.detail || 'Registration failed');
|
setError(err.response?.data?.detail || 'Registration failed');
|
||||||
@@ -109,7 +109,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|||||||
setCurrentUser(fullUser);
|
setCurrentUser(fullUser);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to fetch current user:', err);
|
console.error('Failed to fetch current user:', err);
|
||||||
logout(); // invalid/expired token
|
logout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user