aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/pages/Profile.tsx
blob: 03fef48f286b90b5842fb41253d296496cd4ce20 (plain) (blame)
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
33
34
35
36
37
38
39
import { useNavigate } from 'react-router';
import LoadingDisplay  from "../components/displays/LoadingDisplay";
import SessionExpiredPopup from "../components/SessionExpiredPopup";
import { NavBar } from '../components/NavBar';
import { useAuth } from "../contexts/AuthContext";



const Profile = () => {
  const { user, isLoading, logout } = useAuth();
  const navigate = useNavigate();

  if (isLoading) {
    return <LoadingDisplay message="Loading Profile Page..." />;
  }

  const handleLogout = async () => {
    try {
      await logout();
      navigate("/");
    } catch (error) {
      console.error("Logout failed:", error);
      alert("Network error during logout. Please try again.");
    }
  };

  if (!user) {
    return <SessionExpiredPopup />;
  }

  return (
    <div className="min-h-screen bg-slate-950">
      <NavBar user={user} handleLogout={handleLogout} currentPage="import"/>
      <h1>Profile</h1>
    </div>
  );
};

export default Profile;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage