📦 NEW: Supprimer une fonction frontend
This commit is contained in:
parent
23779087a6
commit
e52847171d
@ -15,6 +15,11 @@ const AdminFunctionComponent = (props) => {
|
|||||||
|
|
||||||
const [slideIndex, setSlideIndex] = useState(0);
|
const [slideIndex, setSlideIndex] = useState(0);
|
||||||
|
|
||||||
|
const handleDeleteFunction = async () => {
|
||||||
|
await api.delete(`/admin/functions/${props.functionInfo.id}`, { headers: { 'Authorization': props.user.token } });
|
||||||
|
redirect({}, '/admin');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<HeadTag title={props.functionInfo.title} description={props.functionInfo.description} image={API_URL + props.functionInfo.image} />
|
<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}
|
user={props.user}
|
||||||
isEditing
|
isEditing
|
||||||
/>
|
/>
|
||||||
|
<div style={{ marginBottom: '30px' }} className="text-center">
|
||||||
|
<button onClick={handleDeleteFunction} className="btn btn-dark">Supprimer la fonction</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="Admin__Function-slide">
|
<div className="Admin__Function-slide">
|
||||||
<EditArticleFunction { ...props } />
|
<EditArticleFunction { ...props } />
|
||||||
|
Reference in New Issue
Block a user