Skip to content

Commit 53fbc10

Browse files
fix: restore missing profile fetch logic
1 parent 900bd35 commit 53fbc10

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/pages/Profile.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ export function Profile() {
7171
const [isMobile, setIsMobile] = useState(false);
7272

7373
useEffect(() => {
74+
async function fetchProfile() {
75+
const { data: { session } } = await supabase.auth.getSession();
76+
if (!session) return;
77+
try {
78+
const res = await fetch('http://localhost:3001/api/profile/summary', {
79+
headers: { 'Authorization': `Bearer ${session.access_token}` }
80+
});
81+
const result = await res.json();
82+
setData(result);
83+
} catch (err) {
84+
console.error('Failed to fetch profile:', err);
85+
} finally {
86+
setIsLoading(false);
87+
}
88+
}
89+
fetchProfile();
90+
7491
const checkMobile = () => setIsMobile(window.innerWidth < 1024);
7592
checkMobile();
7693
window.addEventListener('resize', checkMobile);

0 commit comments

Comments
 (0)