1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: remove return vweb.Result{} everywhere

This commit is contained in:
Alexander Medvednikov
2021-01-08 04:57:02 +01:00
parent e3f8d448c1
commit 352cf91ba2
4 changed files with 14 additions and 24 deletions

View File

@ -70,8 +70,7 @@ fn main() {
}
pub fn (mut app App) index() vweb.Result {
app.text('Hello, world from vweb!')
return vweb.Result{}
return app.text('Hello world from vweb!')
}
pub fn (app &App) init() {
@ -110,8 +109,7 @@ import vweb
import time
fn (mut app App) time() vweb.Result {
app.text(time.now().format())
return vweb.Result{}
return app.text(time.now().format())
}
```
@ -352,8 +350,7 @@ pub fn (mut app App) new_article() vweb.Result {
title := app.form['title']
text := app.form['text']
if title == '' || text == '' {
app.text('Empty text/title')
return vweb.Result{}
return app.text('Empty text/title')
}
article := Article{
title: title
@ -363,8 +360,7 @@ pub fn (mut app App) new_article() vweb.Result {
sql app.db {
insert article into Article
}
app.redirect('/')
return vweb.Result{}
return app.redirect('/')
}
```
@ -391,8 +387,7 @@ import json
pub fn (mut app App) articles() vweb.Result {
articles := app.find_all_articles()
app.json(json.encode(articles))
return vweb.Result{}
return app.json(json.encode(articles))
}
```