class Suppliers::SessionsController < Devise::SessionsController
  respond_to :json

  def create
    # taken from super except the respond_with
    self.resource = warden.authenticate!(auth_options)
    set_flash_message!(:notice, :signed_in)
    sign_in(resource_name, resource)
    yield resource if block_given?
    render json: {employee_id: current_employee.id, auth_token: current_employee.authentication_token}
  end

  def destroy
    session[:supplier_id] = nil
    super
  end
end
