liquid_feedback_frontend
annotate app/main/api/support.lua @ 1719:9b8dc1828f1f
If only one policy is available, choose it automatically
| author | bsw | 
|---|---|
| date | Mon Sep 27 13:07:56 2021 +0200 (2021-09-27) | 
| parents | 37a366b86b49 | 
| children | 
| rev | line source | 
|---|---|
| bsw@1500 | 1 local initiative_id = param.get("initiative_id") | 
| bsw@1500 | 2 | 
| bsw@1500 | 3 local success = util.add_support(initiative_id) | 
| bsw@1500 | 4 | 
| bsw@1500 | 5 slot.set_layout(nil, "application/json") | 
| bsw@1500 | 6 | 
| bsw@1512 | 7 local r = json.object() | 
| bsw@1500 | 8 | 
| bsw@1500 | 9 if success then | 
| bsw@1500 | 10 r.status = "ok" | 
| bsw@1500 | 11 else | 
| bsw@1500 | 12 r.status = "error" | 
| bsw@1500 | 13 end | 
| bsw@1500 | 14 | 
| bsw@1500 | 15 slot.put_into("data", json.export(json.object{ result = r })) | 
| bsw@1500 | 16 slot.put_into("data", "\n") | 
| bsw@1500 | 17 |