refactor: fix linter errors

This commit is contained in:
rramiachraf
2024-07-14 00:43:06 +01:00
parent ea14549d6f
commit b6cae441b3
9 changed files with 55 additions and 43 deletions

View File

@ -2,7 +2,6 @@ package handlers
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
@ -33,7 +32,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
if err != nil {
l.Error(err.Error())
w.WriteHeader(http.StatusInternalServerError)
views.ErrorPage(500, "cannot reach genius servers").Render(context.Background(), w)
utils.RenderTemplate(w, views.ErrorPage(500, "cannot reach genius servers"), l)
return
}
@ -41,7 +40,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
if resp.StatusCode == http.StatusNotFound {
w.WriteHeader(http.StatusNotFound)
views.ErrorPage(404, "page not found").Render(context.Background(), w)
utils.RenderTemplate(w, views.ErrorPage(404, "page not found"), l)
return
}
@ -50,7 +49,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
if err != nil {
l.Error("Error paring genius api response: %s", err.Error())
w.WriteHeader(http.StatusInternalServerError)
views.ErrorPage(500, "something went wrong").Render(context.Background(), w)
utils.RenderTemplate(w, views.ErrorPage(500, "something went wrong"), l)
return
}
@ -59,7 +58,7 @@ func annotations(l *utils.Logger) http.HandlerFunc {
if err != nil {
l.Error("could not unmarshal json: %s\n", err)
w.WriteHeader(http.StatusInternalServerError)
views.ErrorPage(500, "something went wrong").Render(context.Background(), w)
utils.RenderTemplate(w, views.ErrorPage(500, "something went wrong"), l)
return
}