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

This commit is contained in:
Cauê Faleiros
2026-02-25 11:59:53 -03:00
parent a175315437
commit 9f047ece86
6 changed files with 68 additions and 40 deletions

View File

@@ -1,24 +1,29 @@
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 = () => {
// Simulating logged-in user state
const [user, setUser] = useState<User | null>(null);
const [isLoading, setIsLoading] = useState(false);
const [isSuccess, setIsSuccess] = useState(false);
// Form State
const [name, setName] = useState('');
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) => {