backend: implement Issues#do_POST
This commit is contained in:
parent
ff4471b532
commit
3c14c7f02f
1 changed files with 10 additions and 0 deletions
|
@ -1,4 +1,14 @@
|
|||
class Twenty::Servlet::Issues < Twenty::Servlet
|
||||
def do_POST(req, res)
|
||||
Twenty::Issue.new(
|
||||
JSON.parse(req.body)
|
||||
).save!
|
||||
write res,
|
||||
{"content-type" => "application/json"},
|
||||
{"ok": true, errors: []}.to_json
|
||||
rescue
|
||||
write res,
|
||||
{"content-type" => "application/json"},
|
||||
{"ok": false, errors: [$!.class]}.to_json
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue