import { useState } from 'react'; import Loader from '../Loader'; import './FunctionForm.css'; 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) => { event.preventDefault(); api.post(`/functions/${props.slug}`, inputState) .then((response) => { setMessage(response.data.resultHTML); }) .catch((error) => { setMessage(error.response.data.message); }); setIsLoading(false); } const handleChange = (event) => { const inputStateNew = { ...inputState }; inputStateNew[event.target.name] = event.target.value; if (event.target.value !== "") { setIsLoading(true); } else { setIsLoading(false); } setInputState(inputStateNew); } if (props.inputArray.length <= 0) { return (
La fonction n'est pas encore disponible.