Skip to content

Instantly share code, notes, and snippets.

@Hasstrup
Last active November 5, 2024 19:29
Show Gist options
  • Save Hasstrup/b4d8cbe015bf3260984621151c63341b to your computer and use it in GitHub Desktop.
Save Hasstrup/b4d8cbe015bf3260984621151c63341b to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
class UsersController < ApplicationController
def register
context = ::Users::Contexts::Registration.call(input: users_registration_input)
return error_response(context.message) unless context.success?
render json: ::Tokens::TokenBlueprint.render(context.payload), status: :ok
end
def authenticate
context = ::Users::Contexts::Authentication.call(input: users_authentication_input)
return error_response(context.message) unless context.success?
render json: ::Tokens::TokenBlueprint.render(context.payload), status: :ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment