diff --git a/src/console/targets/targets.v b/src/console/targets/targets.v index 521ca234..41793635 100644 --- a/src/console/targets/targets.v +++ b/src/console/targets/targets.v @@ -227,8 +227,7 @@ fn remove(conf Config, id string) ! { if id_int != 0 { c := client.new(conf.address, conf.api_key) - res := c.remove_target(id_int)! - println(res.message) + c.remove_target(id_int)! } } @@ -245,9 +244,7 @@ fn patch(conf Config, id string, params map[string]string) ! { id_int := id.int() if id_int != 0 { c := client.new(conf.address, conf.api_key) - res := c.patch_target(id_int, params)! - - println(res.message) + c.patch_target(id_int, params)! } } diff --git a/src/server/api_targets.v b/src/server/api_targets.v index c4d32d24..16db7e9b 100644 --- a/src/server/api_targets.v +++ b/src/server/api_targets.v @@ -47,7 +47,7 @@ fn (mut app App) v1_post_target() web.Result { id := app.db.add_target(new_repo) - return app.json(http.Status.ok, new_data_response(id)) + return app.json(.ok, new_data_response(id)) } // v1_delete_target removes a given target from the server's list. @@ -55,7 +55,7 @@ fn (mut app App) v1_post_target() web.Result { fn (mut app App) v1_delete_target(id int) web.Result { app.db.delete_target(id) - return app.status(.ok) + return app.json(.ok, new_response('')) } // v1_patch_target updates a target's data with the given query params. @@ -69,5 +69,7 @@ fn (mut app App) v1_patch_target(id int) web.Result { app.db.update_target_archs(id, arch_objs) } - return app.status(.ok) + repo := app.db.get_target(id) or { return app.status(.internal_server_error) } + + return app.json(.ok, new_data_response(repo)) }