Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AJAX URL on subsite #2501

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions assets/js/sync.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import apiFetch from '@wordpress/api-fetch';

/* eslint-disable camelcase, no-use-before-define */
const { ajaxurl, epDash, history } = window;
const { epDash, history } = window;
const { __, sprintf } = wp.i18n;

const { ajax_url: ajaxurl = '' } = epDash;

// Main elements of sync page
const syncBox = document.querySelector('.ep-sync-data');
const deleteAndSyncBox = document.querySelector('.ep-delete-data-and-sync');
Expand Down Expand Up @@ -307,7 +309,7 @@ function updateSyncDash() {
*/
function cancelSync() {
apiFetch({
path: ajaxurl,
url: ajaxurl,
method: 'POST',
body: new URLSearchParams({
action: 'ep_cancel_index',
Expand All @@ -322,7 +324,7 @@ function cancelSync() {

function cliSync() {
const requestSettings = {
path: ajaxurl,
url: ajaxurl,
method: 'POST',
body: new URLSearchParams({
action: 'ep_cli_index',
Expand Down Expand Up @@ -458,7 +460,7 @@ function shouldInterruptSync(value) {
*/
function sync(putMapping = false) {
const requestSettings = {
path: ajaxurl,
url: ajaxurl,
method: 'POST',
body: new URLSearchParams({
action: 'ep_index',
Expand Down
1 change: 1 addition & 0 deletions includes/classes/Screen/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public function admin_enqueue_scripts() {
]
);

$data['ajax_url'] = admin_url( 'admin-ajax.php' );
$data['install_sync'] = empty( $last_sync );
$data['install_complete_url'] = esc_url( $install_complete_url );
$data['sync_complete'] = esc_html__( 'Sync complete', 'elasticpress' );
Expand Down