Keep admin on page after editing sermon

Changed behavior so that editing a sermon no longer redirects to homepage.
Instead, it shows a success message and keeps the form filled for further edits.
Creating a new sermon still redirects to homepage as before.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-04 14:26:30 -05:00
parent 66172e0baa
commit 858f214fab

View File

@@ -535,6 +535,11 @@ async function handleSubmit() {
body body
}) })
success.value = 'Sermon updated successfully!' success.value = 'Sermon updated successfully!'
// Refresh sermon list
await refreshSermons()
// Don't redirect or reset form when editing - stay on page with success message
} else { } else {
// Create new sermon // Create new sermon
await $fetch('/api/sermons', { await $fetch('/api/sermons', {
@@ -542,7 +547,6 @@ async function handleSubmit() {
body body
}) })
success.value = 'Sermon created successfully!' success.value = 'Sermon created successfully!'
}
// Reset form // Reset form
editingSermonId.value = null editingSermonId.value = null
@@ -561,6 +565,7 @@ async function handleSubmit() {
setTimeout(() => { setTimeout(() => {
navigateTo('/') navigateTo('/')
}, 2000) }, 2000)
}
} catch (e: any) { } catch (e: any) {
error.value = e.data?.message || `Failed to ${editingSermonId.value ? 'update' : 'create'} sermon` error.value = e.data?.message || `Failed to ${editingSermonId.value ? 'update' : 'create'} sermon`
} finally { } finally {