Fix issue where on page refresh when on function edit/new sub pages you would be redirected back to dashboard

This commit is contained in:
Peter Stockings
2024-03-27 14:03:52 +11:00
parent 48b013c1f4
commit 1a496d2441
10 changed files with 89 additions and 52 deletions

View File

@@ -277,7 +277,7 @@
<button
class="bg-transparent hover:bg-red-500 text-red-700 font-semibold hover:text-white py-2 px-4 border border-red-500 hover:border-transparent rounded flex mr-2 items-center"
hx-delete="{{ url_for('delete_http_function', name=name) }}" hx-target="#container" hx-swap="innerHTML"
hx-confirm="Are you sure you want to delete {{ name }}?">
hx-confirm="Are you sure you want to delete {{ name }}?" hx-push-url="true">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-4 h-4 mr-2">
<path stroke-linecap="round" stroke-linejoin="round"
@@ -306,10 +306,9 @@
.then(response => response.json())
.then(json => {
if (name != updated_name) {
htmx.ajax('GET', "{{ url_for('get_http_function_edit_form') }}", {
htmx.ajax('GET', "{{ url_for('get_http_function_edit_form', function_id=function_id) }}", {
target: '#container',
swap: 'innerHTML',
values: { name: updated_name }
swap: 'innerHTML'
});
}
else {