Skip to content

Commit

Permalink
feat(layout): Add HTTP/DELETE support to ModelForm
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Oct 3, 2024
1 parent 71ccbea commit 8aef0bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/layout/ModelForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,23 @@ const ModelForm = ({
<form onSubmit={async e => {
e.preventDefault();

if (params.action == 'delete' ) {
meta_action = 'DELETE'
}

const response = await apiFetch(
url,
setFormError,
meta_action,
form_data
)

if (params.action == 'delete' ) {

url = '/' + params.module + '/' + params.model

}

if ( response.ok ) {

navigate(url)
Expand Down

0 comments on commit 8aef0bd

Please sign in to comment.