Submit browser migration batches to the form URL
All checks were successful
WordPress release / release (push) Successful in 5s
All checks were successful
WordPress release / release (push) Successful in 5s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user