Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix incorrect campaign API response when there are no campaigns

Kailash Nadh32a543bf4f06
diff --git a/campaigns.go b/campaigns.go
index e28760be..1fd08499 100644
--- a/campaigns.go
+++ b/campaigns.go
@@ -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++ {