app/assets/javascripts/spree/backend/shipments.js.erb in spree_backend-2.4.4 vs app/assets/javascripts/spree/backend/shipments.js.erb in spree_backend-2.4.5
- old
+ new
@@ -64,11 +64,14 @@
var link = $(this);
var shipment_number = link.data('shipment-number');
var url = Spree.url(Spree.routes.shipments_api + '/' + shipment_number + '/ship.json');
$.ajax({
type: 'PUT',
- url: url
+ url: url,
+ data: {
+ token: Spree.api_key
+ }
}).done(function () {
window.location.reload();
}).error(function (msg) {
console.log(msg);
});
@@ -93,11 +96,12 @@
url: url,
data: {
shipment: {
selected_shipping_rate_id: selected_shipping_rate_id,
unlock: unlock
- }
+ },
+ token: Spree.api_key
}
}).done(function () {
window.location.reload();
}).error(function (msg) {
console.log(msg);
@@ -129,11 +133,12 @@
type: 'PUT',
url: url,
data: {
shipment: {
tracking: tracking
- }
+ },
+ token: Spree.api_key
}
}).done(function (data) {
link.parents('tbody').find('tr.edit-tracking').toggle();
var show = link.parents('tbody').find('tr.show-tracking');
@@ -161,11 +166,15 @@
if(new_quantity!=0){
$.ajax({
type: "PUT",
url: Spree.url(url),
- data: { variant_id: variant_id, quantity: new_quantity }
+ data: {
+ variant_id: variant_id,
+ quantity: new_quantity,
+ token: Spree.api_key
+ }
}).done(function( msg ) {
window.location.reload();
});
}
}
@@ -205,11 +214,12 @@
async: false,
url: Spree.url(Spree.routes.variants_api),
data: {
q: {
"id_eq": variant_id
- }
+ },
+ token: Spree.api_key
}
}).success(function( data ) {
variant = data['variants'][0];
}).error(function( msg ) {
console.log(msg);
@@ -260,11 +270,12 @@
url: Spree.url(Spree.routes.shipments_api + "/transfer_to_location"),
data: {
original_shipment_number: original_shipment_number,
variant_id: variant_id,
quantity: quantity,
- stock_location_id: stock_location_id
+ stock_location_id: stock_location_id,
+ token: Spree.api_key
}
}).error(function(msg) {
alert(msg.responseJSON['message']);
}).done(function(msg) {
window.Spree.advanceOrder();
@@ -277,11 +288,12 @@
url: Spree.url(Spree.routes.shipments_api + "/transfer_to_shipment"),
data: {
original_shipment_number: original_shipment_number,
target_shipment_number: target_shipment_number,
variant_id: variant_id,
- quantity: quantity
+ quantity: quantity,
+ token: Spree.api_key
}
}).error(function(msg) {
alert(msg.responseJSON['message']);
}).done(function(msg) {
window.Spree.advanceOrder();
@@ -315,10 +327,15 @@
if(shipment==undefined){
$.ajax({
type: "POST",
url: Spree.url(Spree.routes.shipments_api + "?shipment[order_id]=" + order_number),
- data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
+ data: {
+ variant_id: variant_id,
+ quantity: quantity,
+ stock_location_id: stock_location_id,
+ token: Spree.api_key
+ }
}).done(function( msg ) {
window.location.reload();
}).error(function( msg ) {
console.log(msg);
});