Maj dashboard, boutique + ajout de produit
This commit is contained in:
@@ -6,6 +6,7 @@ import { Image as ImageIcon, Sparkles, Youtube, X, Globe, Facebook, Linkedin, In
|
||||
import { Business, CATEGORIES } from '../../types';
|
||||
import { generateBusinessDescription } from '../../lib/geminiService';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { useUser } from '../UserProvider';
|
||||
|
||||
// Helper to extract youtube ID
|
||||
const getYouTubeId = (url: string) => {
|
||||
@@ -15,6 +16,7 @@ const getYouTubeId = (url: string) => {
|
||||
};
|
||||
|
||||
const DashboardProfile = ({ business, setBusiness }: { business: Business, setBusiness: (b: Business) => void }) => {
|
||||
const { login } = useUser();
|
||||
const [formData, setFormData] = useState(business);
|
||||
const [videoInput, setVideoInput] = useState(business.videoUrl || '');
|
||||
const [videoPreviewId, setVideoPreviewId] = useState<string | null>(getYouTubeId(business.videoUrl || ''));
|
||||
@@ -77,6 +79,9 @@ const DashboardProfile = ({ business, setBusiness }: { business: Business, setBu
|
||||
toast.error(data.error);
|
||||
} else {
|
||||
setBusiness(data);
|
||||
if (data.owner && login) {
|
||||
login(data.owner);
|
||||
}
|
||||
toast.success('Profil mis à jour avec succès !');
|
||||
// Optional: refresh page to show in annuaire
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user