Skip to content

Commit

Permalink
Merge pull request #2017 from jhawthorn/stronger_spree_url_deprecation
Browse files Browse the repository at this point in the history
Emit Spree.url deprecation warning in all envs
  • Loading branch information
jhawthorn authored Jun 15, 2017
2 parents f0cabac + 6d1f959 commit cf9eebd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/app/assets/javascripts/spree.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Spree.pathFor = function(path) {
};

Spree.url = function(uri, query) {
if (Spree.env === 'development' || Spree.env === 'test') {
console.warn('Spree.url is deprecated, please use Spree.ajax for your request instead.');
if (console && console.warn) {
console.warn('Spree.url is deprecated, and will be removed from a future Solidus version.');
}
if (uri.path === undefined) {
uri = new Uri(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Spree.onCouponCodeApply = (e) ->
couponStatus = $("#coupon_status")
successClass = 'success'
errorClass = 'alert'
url = Spree.url(Spree.routes.apply_coupon_code(Spree.current_order_id),
{
order_token: Spree.current_order_token,
coupon_code: couponCode
}
)

couponStatus.removeClass([successClass,errorClass].join(" "))

data =
order_token: Spree.current_order_token,
coupon_code: couponCode

req = Spree.ajax
method: "PUT",
url: url
method: "PUT"
url: Spree.routes.apply_coupon_code(Spree.current_order_id)
data: JSON.stringify(data)
contentType: "application/json"

req.done (data) ->
window.location.reload()
Expand Down

0 comments on commit cf9eebd

Please sign in to comment.