aboutsummaryrefslogtreecommitdiff
path: root/src/actions/api/sign_ins/create.cr
blob: 3670356c73a69602dc5f7d271c384d5c71a508fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
class Api::SignIns::Create < ApiAction
  include Api::Auth::SkipRequireAuthToken

  post "/api/sign_ins" do
    SignInUser.run(params) do |operation, user|
      if user
        json({token: UserToken.generate(user)})
      else
        raise Avram::InvalidOperationError.new(operation)
      end
    end
  end
end