27
This commit is contained in:
@@ -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)
|
||||
}
|
Reference in New Issue
Block a user