Fix incorrect campaign API response when there are no campaigns

This commit is contained in:
Kailash Nadh 2019-12-06 21:39:18 +05:30
parent 6747a95b3d
commit 32a543bf4f
1 changed files with 2 additions and 2 deletions

View File

@ -90,8 +90,8 @@ func handleGetCampaigns(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, "Campaign not found.")
}
if len(out.Results) == 0 {
out.Results = make([]models.Campaign, 0)
return c.JSON(http.StatusOK, out)
out.Results = []models.Campaign{}
return c.JSON(http.StatusOK, okResp{out})
}
for i := 0; i < len(out.Results); i++ {