// Client-side wrapper that calls the server-side /api/gemini route export const generateBusinessDescription = async ( name: string, category: string, keywords: string ): Promise => { try { const res = await fetch('/api/gemini', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'description', name, category, keywords }), }) if (!res.ok) throw new Error('API error') const data = await res.json() return data.text || 'Impossible de générer une description pour le moment.' } catch (error) { console.error('Gemini API Error:', error) return 'Erreur lors de la génération. Veuillez rédiger votre description manuellement.' } } export const generateBusinessIdeas = async ( category: string ): Promise => { try { const res = await fetch('/api/gemini', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'slogans', category }), }) if (!res.ok) throw new Error('API error') const data = await res.json() return data.slogans || ["L'excellence au service de l'Afrique"] } catch { return ['Votre slogan ici'] } }