From 8aef0bdf4cdd14fb34115ff0b3f2de21585b5915 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 3 Oct 2024 17:55:03 +0930 Subject: [PATCH] feat(layout): Add HTTP/DELETE support to ModelForm ref: #1 nofusscomputing/centurion_erp#248 nofusscomputing/centurion_erp#307 nofusscomputing/centurion_erp#319 --- src/layout/ModelForm.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/layout/ModelForm.jsx b/src/layout/ModelForm.jsx index 9b21fa7..d081951 100644 --- a/src/layout/ModelForm.jsx +++ b/src/layout/ModelForm.jsx @@ -134,6 +134,10 @@ const ModelForm = ({
{ e.preventDefault(); + if (params.action == 'delete' ) { + meta_action = 'DELETE' + } + const response = await apiFetch( url, setFormError, @@ -141,6 +145,12 @@ const ModelForm = ({ form_data ) + if (params.action == 'delete' ) { + + url = '/' + params.module + '/' + params.model + + } + if ( response.ok ) { navigate(url)