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