Sha256: d8fd3f0268baa3ea2554afb11e78a8add87e9654ecf2a09ade2abf6a4dca3602

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

window.Solidus = {};

Solidus.mountedAt = () => {
  return '<%= Rails.application.routes.url_helpers.spree_path(trailing_slash: true) %>';
};

Solidus.pathFor = (path) => {
  const hostname = window.location.hostname;
  const protocol = window.location.protocol;
  const port = window.location.port;
  const locationOrigin = protocol + '//' + hostname + (port ? ':' + port : '');
  return locationOrigin + Solidus.mountedAt() + path;
};

Solidus.routes = {
  states_search: Solidus.pathFor('api/states'),
  apply_coupon_code: (order_id) => Solidus.pathFor('api/orders/' + order_id + '/coupon_codes')
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 app/assets/javascripts/spree/frontend/utils.js.erb