const handleCreate = async (formData) => { try { const newProduct = await api.private .post('products', { json: formData }) .json(); // Ajouter à la liste locale st.set('products', [...st.get('products'), newProduct]); // Ou mettre à jour l'état global // const gst = useGlobalStates(); // gst.set('products', [...gst.get('products'), newProduct]); nav.navigate('/products'); } catch (err) { st.set('error', err.message); } };