Fix incorrect ID handling in update handlers

This commit is contained in:
Kailash Nadh 2021-03-09 17:54:07 +05:30
parent 93a710c9ae
commit f8e555dac5
2 changed files with 2 additions and 3 deletions

View File

@ -310,7 +310,7 @@ func handleUpdateSubscriber(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("subscribers.invalidName"))
}
_, err := app.queries.UpdateSubscriber.Exec(req.ID,
_, err := app.queries.UpdateSubscriber.Exec(id,
strings.ToLower(strings.TrimSpace(req.Email)),
strings.TrimSpace(req.Name),
req.Status,

View File

@ -177,8 +177,7 @@ func handleUpdateTemplate(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
}
// TODO: PASSWORD HASHING.
res, err := app.queries.UpdateTemplate.Exec(o.ID, o.Name, o.Body)
res, err := app.queries.UpdateTemplate.Exec(id, o.Name, o.Body)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts("globals.messages.errorUpdating",