Submit browser migration batches to the form URL
All checks were successful
WordPress release / release (push) Successful in 5s

This commit is contained in:
josh
2026-11-12 13:44:39 -05:00
parent c3db26ecf9
commit 2ace78b669
2 changed files with 5 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
(() => {
const form = document.querySelector('[data-be-migrate]');
if (!form) return;
// The hidden WordPress action input shadows the form.action property.
const endpoint = form.getAttribute('action');
const {__, sprintf} = wp.i18n;
const button = form.querySelector('button[type="submit"]');
@@ -14,7 +16,7 @@
async function requestBatch(body) {
for (let attempt = 0; ; attempt++) {
const response = await fetch(form.action, {
const response = await fetch(endpoint, {
method: 'POST', body, credentials: 'same-origin', headers: {Accept: 'application/json'},
}).catch(() => null);
if (response && (attempt === 2 || !retryableStatuses.has(response.status))) return response;