mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
fix: Include pending_id in redirect URL and form data when available
This commit is contained in:
@@ -799,6 +799,9 @@ if (modal && browser) {
|
||||
if (wizard?.requestStep) {
|
||||
try {
|
||||
const target = new URL(redirectUrl, window.location.origin);
|
||||
if (payload.pending_id && !target.searchParams.has('pending_id')) {
|
||||
target.searchParams.set('pending_id', payload.pending_id);
|
||||
}
|
||||
target.searchParams.set('format', 'json');
|
||||
if (!target.searchParams.has('step')) {
|
||||
target.searchParams.set('step', 'book');
|
||||
@@ -812,6 +815,7 @@ if (modal && browser) {
|
||||
window.location.assign(redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error');
|
||||
} finally {
|
||||
|
||||
@@ -330,6 +330,12 @@ const submitWizardForm = async (form, submitter) => {
|
||||
if (submitter && submitter.name && !formData.has(submitter.name)) {
|
||||
formData.append(submitter.name, submitter.value ?? "");
|
||||
}
|
||||
|
||||
// Ensure pending_id is included if available in modal state but missing from form
|
||||
if (!formData.get("pending_id") && modal && modal.dataset.pendingId) {
|
||||
formData.set("pending_id", modal.dataset.pendingId);
|
||||
}
|
||||
|
||||
const allowValidation = !submitter?.hasAttribute("formnovalidate") && !form.noValidate;
|
||||
if (allowValidation && typeof form.reportValidity === "function" && !form.reportValidity()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user