import { Fragment, useState } from 'react'; import Loader from './Loader'; import htmlParser from 'html-react-parser'; import api from '../utils/api'; const FunctionForm = (props) => { // console.log(props); const [inputState, setInputState] = useState({}); const [message, setMessage] = useState(""); const [isLoading, setIsLoading] = useState(false); const handleSubmit = (event) => { setIsLoading(true); event.preventDefault(); api.post(`/functions/${props.slug}`, inputState) .then((response) => { setMessage(response.data.resultHTML); setIsLoading(false); }) .catch((error) => { setMessage(error.response.data.message); setIsLoading(false); }); } const handleChange = (event) => { const inputStateNew = { ...inputState }; inputStateNew[event.target.name] = event.target.value; setInputState(inputStateNew); } if (props.inputArray.length <= 0) { return (
La fonction n'est pas encore disponible.