retrieving user that makes the purchase with nonce ok
This commit is contained in:
@@ -12,6 +12,7 @@ export async function createOrder() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
"X-WP-Nonce": PLGNTLS_data.rest_nonce,
|
||||||
},
|
},
|
||||||
// use the "body" param to optionally pass additional order information
|
// use the "body" param to optionally pass additional order information
|
||||||
// like product ids and quantities
|
// like product ids and quantities
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export async function onApprove(data, actions) {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
"X-WP-Nonce": PLGNTLS_data.rest_nonce,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,11 @@ class PLGNTLS_class
|
|||||||
{
|
{
|
||||||
// add ajax file at beginning of files list
|
// add ajax file at beginning of files list
|
||||||
array_unshift($scripts_arr, "utils/plugin_ajax.js");
|
array_unshift($scripts_arr, "utils/plugin_ajax.js");
|
||||||
$nonce = array("ajax_nonce" => wp_create_nonce('wp-pageviews-nonce'));
|
$ajax_nonce = array("ajax_nonce" => wp_create_nonce('wp-pageviews-nonce'));
|
||||||
|
$rest_nonce = array("rest_nonce" => wp_create_nonce('wp_rest'));
|
||||||
$ajax_url = array("ajax_url" => admin_url('admin-ajax.php'));
|
$ajax_url = array("ajax_url" => admin_url('admin-ajax.php'));
|
||||||
$vars = array_merge($vars, $nonce);
|
$vars = array_merge($vars, $ajax_nonce);
|
||||||
|
$vars = array_merge($vars, $rest_nonce);
|
||||||
$vars = array_merge($vars, $ajax_url);
|
$vars = array_merge($vars, $ajax_url);
|
||||||
}
|
}
|
||||||
$fetch_url = array("fetch_url" => get_site_url() . "/wp-json");
|
$fetch_url = array("fetch_url" => get_site_url() . "/wp-json");
|
||||||
@@ -198,10 +200,10 @@ class PLGNTLS_class
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* uncomment to print all enqueued scripts, can be usefull
|
* uncomment to print all enqueued scripts, can be usefull
|
||||||
*/
|
|
||||||
global $wp_scripts;
|
global $wp_scripts;
|
||||||
error_log("wp_scripts->queue:");
|
error_log("wp_scripts->queue:");
|
||||||
error_log(json_encode($wp_scripts->queue));
|
error_log(json_encode($wp_scripts->queue));
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private function check_dependencies(&$script, $previous_basename)
|
private function check_dependencies(&$script, $previous_basename)
|
||||||
|
|||||||
Reference in New Issue
Block a user