Sha256: 8694368ee1460013d47550b1146e68d8b6adeddaa4ce51abed75ff8b4a669345

Contents?: true

Size: 1.22 KB

Versions: 17

Compression:

Stored size: 1.22 KB

Contents

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

    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 account_link
      render partial: 'spree/shared/link_to_account'
      fresh_when(try_spree_current_user)
    end

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

    def api_tokens
      render json: {
        order_token: simple_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

    def store_etag
      [
        current_store,
        current_currency,
        I18n.locale
      ]
    end

    def store_last_modified
      (current_store.updated_at || Time.current).utc
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
spree_frontend-4.1.15 app/controllers/spree/store_controller.rb
spree_frontend-4.1.14 app/controllers/spree/store_controller.rb
spree_frontend-4.1.13.1 app/controllers/spree/store_controller.rb
spree_frontend-4.2.0.rc4 app/controllers/spree/store_controller.rb
spree_frontend-4.1.13 app/controllers/spree/store_controller.rb
spree_frontend-4.1.12 app/controllers/spree/store_controller.rb
spree_frontend-4.1.11 app/controllers/spree/store_controller.rb
spree_frontend-4.1.10 app/controllers/spree/store_controller.rb
spree_frontend-4.1.9 app/controllers/spree/store_controller.rb
spree_frontend-4.1.8 app/controllers/spree/store_controller.rb
spree_frontend-4.1.7 app/controllers/spree/store_controller.rb
spree_frontend-4.1.6 app/controllers/spree/store_controller.rb
spree_frontend-4.1.5 app/controllers/spree/store_controller.rb
spree_frontend-4.1.4 app/controllers/spree/store_controller.rb
spree_frontend-4.1.3 app/controllers/spree/store_controller.rb
spree_frontend-4.1.2 app/controllers/spree/store_controller.rb
spree_frontend-4.1.1 app/controllers/spree/store_controller.rb