# frozen_string_literal: true module Api # The controller that handles authentications. class AuthenticationsController < ApplicationController def create @token = logic(permitted_params).call render json: @token, status: :ok and return if @token render json: { error_message: 'Credenciales incorrectas' }, status: :unauthorized end def destroy; end def refresh; end private def permitted_params params.require(:credentials).permit(:email, :password) end def service @service = Services::AuthenticationService.new(permitted_params) end end end