📦 NEW: Supprimer une fonction frontend

This commit is contained in:
Divlo 2020-05-06 09:55:27 +02:00
parent 23779087a6
commit e52847171d

View File

@ -15,6 +15,11 @@ const AdminFunctionComponent = (props) => {
const [slideIndex, setSlideIndex] = useState(0);
const handleDeleteFunction = async () => {
await api.delete(`/admin/functions/${props.functionInfo.id}`, { headers: { 'Authorization': props.user.token } });
redirect({}, '/admin');
}
return (
<Fragment>
<HeadTag title={props.functionInfo.title} description={props.functionInfo.description} image={API_URL + props.functionInfo.image} />
@ -44,6 +49,9 @@ const AdminFunctionComponent = (props) => {
user={props.user}
isEditing
/>
<div style={{ marginBottom: '30px' }} className="text-center">
<button onClick={handleDeleteFunction} className="btn btn-dark">Supprimer la fonction</button>
</div>
</div>
<div className="Admin__Function-slide">
<EditArticleFunction { ...props } />