From 1aaeb02b0e0b3b822b8637291cc21549700bde25 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 6 Apr 2022 19:31:37 +0300 Subject: [PATCH] fix jsmod --- main.v | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/main.v b/main.v index bf14c4e..596b3f1 100644 --- a/main.v +++ b/main.v @@ -131,15 +131,12 @@ pub fn (mut app App) mod(name string) vweb.Result { } ['/jsmod/:name'] -pub fn (mut app App) jsmod() { - name := app.req.url.replace('jsmod/', '')[1..] - println('MOD name=$name') +pub fn (mut app App) jsmod(name string) vweb.Result { + // name := app.req.url.replace('jsmod/', '')[1..] + println('jsMOD name=$name') app.mods_repo.inc_nr_downloads(name) - mod := app.retrieve(name) or { - app.json('404') - return - } - app.json(json.encode(mod)) + mod := app.retrieve(name) or { return app.json('404') } + return app.json(json.encode(mod)) } // "/post/:id/:title"