feat(server): the endpoint complete campaigns is switched to the post method

pull/3224/head
Andrus Diaz German 2024-09-23 19:36:42 -04:00
parent 8e79294413
commit f34d9405e2
2 changed files with 2 additions and 2 deletions

View File

@ -126,7 +126,7 @@ func (as *Server) CampaignComplete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
id, _ := strconv.ParseInt(vars["id"], 0, 64) id, _ := strconv.ParseInt(vars["id"], 0, 64)
switch { switch {
case r.Method == "GET": case r.Method == "POST" || r.Method == "GET":
err := models.CompleteCampaign(id, ctx.Get(r, "user_id").(int64)) err := models.CompleteCampaign(id, ctx.Get(r, "user_id").(int64))
if err != nil { if err != nil {
JSONResponse(w, models.Response{Success: false, Message: "Error completing campaign"}, http.StatusInternalServerError) JSONResponse(w, models.Response{Success: false, Message: "Error completing campaign"}, http.StatusInternalServerError)

View File

@ -102,7 +102,7 @@ var api = {
}, },
// complete() - Completes a campaign at POST /campaigns/:id/complete // complete() - Completes a campaign at POST /campaigns/:id/complete
complete: function (id) { complete: function (id) {
return query("/campaigns/" + id + "/complete", "GET", {}, true) return query("/campaigns/" + id + "/complete", "POST", {}, true)
}, },
// summary() - Queries the API for GET /campaigns/summary // summary() - Queries the API for GET /campaigns/summary
summary: function (id) { summary: function (id) {