Sha256: df77247bf6701b37aca5f008c2e10aa655543409dba82681d2a9d51f9854ae33

Contents?: true

Size: 980 Bytes

Versions: 22

Compression:

Stored size: 980 Bytes

Contents

module Spree
  class StoreController < Spree::BaseController
    include Spree::Core::ControllerHelpers::Order

    skip_before_action :set_current_order, only: :cart_link
    skip_before_action :verify_authenticity_token, only: :ensure_cart, raise: false

    def forbidden
      render 'spree/shared/forbidden', layout: Spree::Config[:layout], status: 403
    end

    def unauthorized
      render 'spree/shared/unauthorized', layout: Spree::Config[:layout], status: 401
    end

    def cart_link
      render partial: 'spree/shared/link_to_cart'
      fresh_when(simple_current_order)
    end

    def api_tokens
      render json: {
        order_token: current_order&.token,
        oauth_token: current_oauth_token&.token
      }
    end

    def ensure_cart
      render json: current_order(create_order_if_necessary: true) # force creation of order if doesn't exists
    end

    protected

    def config_locale
      Spree::Frontend::Config[:locale]
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_frontend-4.0.9 app/controllers/spree/store_controller.rb
spree_frontend-4.0.8 app/controllers/spree/store_controller.rb
spree_frontend-3.7.14.1 app/controllers/spree/store_controller.rb
spree_frontend-4.0.7.1 app/controllers/spree/store_controller.rb
spree_frontend-4.0.7 app/controllers/spree/store_controller.rb
spree_frontend-3.7.14 app/controllers/spree/store_controller.rb
spree_frontend-4.0.6 app/controllers/spree/store_controller.rb
spree_frontend-3.7.13 app/controllers/spree/store_controller.rb
spree_frontend-4.0.5 app/controllers/spree/store_controller.rb
spree_frontend-3.7.12 app/controllers/spree/store_controller.rb
spree_frontend-4.0.4 app/controllers/spree/store_controller.rb
spree_frontend-3.7.11 app/controllers/spree/store_controller.rb
spree_frontend-3.7.10 app/controllers/spree/store_controller.rb
spree_frontend-4.0.3 app/controllers/spree/store_controller.rb
spree_frontend-3.7.9 app/controllers/spree/store_controller.rb
spree_frontend-4.0.2 app/controllers/spree/store_controller.rb
spree_frontend-3.7.8 app/controllers/spree/store_controller.rb
spree_frontend-4.0.1 app/controllers/spree/store_controller.rb
spree_frontend-3.7.7 app/controllers/spree/store_controller.rb
spree_frontend-4.0.0 app/controllers/spree/store_controller.rb