fix: host modal — single POST endpoint for create+edit, remove hx-put conflict
- hx-put="" (empty) was causing HTMX to send wrong requests - Now use single hx-post="/hosts" with hidden hostId field - Server checks hostId: empty → create, present → update - UpdateHost reads ID from both URL param and form data
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form :hx-post="editing ? null : '/hosts'"
|
||||
:hx-put="editing ? '/hosts/' + hostId : null"
|
||||
<form hx-post="/hosts"
|
||||
hx-target="#host-list" hx-swap="innerHTML"
|
||||
@submit="open = false; $dispatch('toast-message', { message: editing ? 'Host updated' : 'Host added' })"
|
||||
class="p-6 space-y-4 text-sm">
|
||||
<input type="hidden" name="hostId" :value="editing ? hostId : ''">
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="flex flex-col gap-1.5">
|
||||
|
||||
Reference in New Issue
Block a user