FIX: warnings
This commit is contained in:
parent
67807992bc
commit
c32ecbff8f
57 changed files with 1898 additions and 21 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/Bronku/iroon/internal/models"
|
||||
)
|
||||
|
||||
func (h *Server) orders(r *http.Request) (any, int, error) {
|
||||
func (h *Server) orders(_ *http.Request) (any, int, error) {
|
||||
//r.URL.Query().Get()
|
||||
orders, err := h.s.GetTopOrders(time.Now(), time.Now().Add(time.Hour*24))
|
||||
data := struct {
|
||||
|
|
@ -35,7 +35,7 @@ func (h *Server) ordersSearch(r *http.Request) (any, int, error) {
|
|||
return data, http.StatusOK, err
|
||||
}
|
||||
|
||||
func (h *Server) cakes(r *http.Request) (any, int, error) {
|
||||
func (h *Server) cakes(_ *http.Request) (any, int, error) {
|
||||
data, err := h.s.GetCakes()
|
||||
return data, http.StatusOK, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package server
|
|||
|
||||
import "net/http"
|
||||
|
||||
func (s *Server) redirect(path string, code int) http.HandlerFunc {
|
||||
func (h *Server) redirect(path string, code int) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, path, code)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ func (h *Server) loadTemplates() {
|
|||
h.tmpl = make(map[string]*template.Template)
|
||||
for _, page := range h.routes {
|
||||
tmpl, err := template.ParseFS(templates,
|
||||
"templates/layout/*.html",
|
||||
"templates/"+page.template+".html",
|
||||
"templates/layout/*.gohtml",
|
||||
"templates/"+page.template+".gohtml",
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
@ -26,14 +26,14 @@ func (h *Server) loadTemplates() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Server) render(fetch fetcher, templateFile string, templateEntry string) http.HandlerFunc {
|
||||
func (h *Server) render(fetch fetcher, templateFile string, templateEntry string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, code, err := fetch(r)
|
||||
if err != nil {
|
||||
logging.ErrorPage(err, code).ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
err = s.tmpl[templateFile].ExecuteTemplate(w, templateEntry, data)
|
||||
err = h.tmpl[templateFile].ExecuteTemplate(w, templateEntry, data)
|
||||
if err != nil {
|
||||
logging.ErrorPage(err, http.StatusInternalServerError).ServeHTTP(w, r)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue