From e429ff701a8e2fc6fc43fc399cd6f39e51250ac8 Mon Sep 17 00:00:00 2001 From: libexi01 Date: Sun, 30 Jun 2024 02:38:38 +0530 Subject: [PATCH] 27 --- src/controller.v | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/controller.v b/src/controller.v index caea359..48aa469 100644 --- a/src/controller.v +++ b/src/controller.v @@ -2,7 +2,20 @@ module main import vweb -@[post] -pub fn (mut app App) signup() vweb.Result{ - return $vweb.html() +@['/signup'; post] +pub fn (mut app App) post_signup(username string, email string, password string) vweb.Result{ + app.service_add_user(username, email, password) or { + mut noti := Noti{ + status: "failure", + message: err.str() + } + return app.json(noti) + } + + noti := Noti{ + status: "success", + message: "User created successfully" + } + + return app.json(noti) } \ No newline at end of file