aboutsummaryrefslogtreecommitdiff
path: root/src/actions/api/sign_ins
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/api/sign_ins')
-rw-r--r--src/actions/api/sign_ins/create.cr13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/actions/api/sign_ins/create.cr b/src/actions/api/sign_ins/create.cr
new file mode 100644
index 0000000..3670356
--- /dev/null
+++ b/src/actions/api/sign_ins/create.cr
@@ -0,0 +1,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