fix: Improve form submission redirection logic for iOS and update navigation link formatting
This commit is contained in:
@@ -156,11 +156,14 @@ function fixIOSFormSubmission() {
|
||||
// Show success and redirect
|
||||
alert(data.message || 'Element erfolgreich hinzugefügt');
|
||||
|
||||
// Redirect to the appropriate page
|
||||
// Redirect back to the configured target or the current page
|
||||
const redirectTarget = form.dataset.successRedirect || form.dataset.redirectUrl || window.location.pathname;
|
||||
if (data.itemId) {
|
||||
window.location.href = `/home_admin?highlight_item=${data.itemId}`;
|
||||
const redirectUrl = new URL(redirectTarget, window.location.origin);
|
||||
redirectUrl.searchParams.set('highlight_item', data.itemId);
|
||||
window.location.href = redirectUrl.toString();
|
||||
} else {
|
||||
window.location.href = '/home_admin';
|
||||
window.location.href = redirectTarget;
|
||||
}
|
||||
} else {
|
||||
// Show error
|
||||
|
||||
Reference in New Issue
Block a user