File size: 800 Bytes
3299552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { useEffect } from 'react';
import { useAuth } from '../../hooks/useAuth';
import { Box, Typography, CircularProgress } from '@mui/material';

const Logout = () => {
  const { logout } = useAuth();

  useEffect(() => {
    const performLogout = async () => {
      try {
        await logout();
        // navigation is now handled inside logout()
      } catch (error) {
        console.error('Logout error:', error);
        // navigation fallback is handled in useAuth.js
      }
    };

    performLogout();
  }, [logout]);

  return (
    <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', mt: 8 }}>
      <Typography variant="h6" gutterBottom>
        Logging out...
      </Typography>
      <CircularProgress />
    </Box>
  );
};

export default Logout;