From 9d583c0dc957a3ab5c48dd91946ce326ce2f08f9 Mon Sep 17 00:00:00 2001 From: libexi01 Date: Tue, 2 Jul 2024 03:48:58 +0530 Subject: [PATCH] 33 --- src/controller.v | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/controller.v b/src/controller.v index 48aa469..bce62aa 100644 --- a/src/controller.v +++ b/src/controller.v @@ -18,4 +18,17 @@ pub fn (mut app App) post_signup(username string, email string, password string) } return app.json(noti) +} + +@['/login'; post] +pub fn (mut app App) post_login(username string, password string) vweb.Result{ + user := app.service_login(username, password) or { + mut noti := Noti{ + status: "failure", + message: err.str() + } + return app.json(noti) + } + + return app.json(user) } \ No newline at end of file