Fix JSON error on HTML form subscription

This commit is contained in:
Kailash Nadh 2020-05-16 23:30:43 +05:30
parent 9d3ca357f6
commit 69d3e9b9c8
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package main
import ( import (
"bytes" "bytes"
"database/sql" "database/sql"
"fmt"
"html/template" "html/template"
"image" "image"
"image/png" "image/png"
@ -268,7 +269,8 @@ func handleSubscriptionForm(c echo.Context) error {
req.Status = models.SubscriberStatusEnabled req.Status = models.SubscriberStatusEnabled
req.ListUUIDs = pq.StringArray(req.SubListUUIDs) req.ListUUIDs = pq.StringArray(req.SubListUUIDs)
if _, err := insertSubscriber(req.SubReq, app); err != nil { if _, err := insertSubscriber(req.SubReq, app); err != nil {
return err return c.Render(http.StatusInternalServerError, tplMessage,
makeMsgTpl("Error", "", fmt.Sprintf("%s", err.(*echo.HTTPError).Message)))
} }
return c.Render(http.StatusInternalServerError, tplMessage, return c.Render(http.StatusInternalServerError, tplMessage,