class Api::V1::LessonsTokensController < Api::ApiController
  skip_before_action :verify_authenticity_token

  def create
    token = CreateLessonsToken
      .new(current_user, params[:classroom_unit_id])
      .call
    # This HEADER is required when POST requests are made by Javascript
    # At least, that's what we think to be the case
    headers['Access-Control-Allow-Credentials'] = 'true'
    render json: { token: token }
  end
end

class Api::V1::LessonsTokensController < Api::ApiController
  skip_before_action :verify_authenticity_token

  def create
    token = CreateLessonsToken
      .new(current_user, params[:classroom_unit_id])
      .call
    render json: { token: token }
  end
end

Revert "Set the 'Access-Control-Allow-Credentials' header"
Revert "Set the 'Access-Control-Allow-Credentials' header"

This reverts commit 10b9ee84094e3827457b2fed7d405733e2c28e32.

We're doing this so that we can do a more generalized addition of this header to ALL API calls
