feat: fix profile viewing and implement real user login state
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m47s

This commit is contained in:
Cauê Faleiros
2026-02-25 11:04:51 -03:00
parent a175315437
commit 456f13c930
6 changed files with 66 additions and 37 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Camera, Save, Mail, User as UserIcon, Building, Shield, Loader2, CheckCircle2 } from 'lucide-react';
import { USERS } from '../constants';
import { getUserById } from '../services/dataService';
import { User } from '../types';
export const UserProfile: React.FC = () => {
@@ -14,11 +14,18 @@ export const UserProfile: React.FC = () => {
const [bio, setBio] = useState('');
useEffect(() => {
// Simulate fetching user data
const currentUser = USERS[0];
setUser(currentUser);
setName(currentUser.name);
setBio(currentUser.bio || '');
const fetchUser = async () => {
const storedId = localStorage.getItem('ctms_user_id');
if (storedId) {
const fetchedUser = await getUserById(storedId);
if (fetchedUser) {
setUser(fetchedUser);
setName(fetchedUser.name);
setBio(fetchedUser.bio || '');
}
}
};
fetchUser();
}, []);
const handleSubmit = (e: React.FormEvent) => {