"use client"; import React, { useState } from 'react'; import { User, Mail, Phone, MapPin, FileText, Save, Loader2 } from 'lucide-react'; import { useUser } from '../UserProvider'; import { toast } from 'react-hot-toast'; const DashboardProfileClient = () => { const { user, login } = useUser(); const [loading, setLoading] = useState(false); const [formData, setFormData] = useState({ name: user?.name || '', email: user?.email || '', phone: user?.phone || '', bio: user?.bio || '', location: user?.location || '', }); const handleChange = (e: React.ChangeEvent) => { setFormData({ ...formData, [e.target.name]: e.target.value }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); try { const res = await fetch('/api/users/me', { method: 'PATCH', headers: { 'Content-Type': 'application/json', 'x-user-id': user?.id || '' }, body: JSON.stringify(formData) }); const data = await res.json(); if (!data.error) { login(data); // Sync local storage/context toast.success('Profil personnel mis à jour !'); } else { toast.error(data.error); } } catch (error) { toast.error('Erreur lors de la sauvegarde'); } finally { setLoading(false); } }; return (

Informations Personnelles

Ces informations sont visibles par les entrepreneurs que vous contactez.