Massive refactor!
This commit is contained in:
@@ -6,12 +6,13 @@ import (
|
||||
"net/http"
|
||||
|
||||
helpers "synlotto-website/helpers"
|
||||
templateHelpers "synlotto-website/helpers/template"
|
||||
"synlotto-website/models"
|
||||
)
|
||||
|
||||
func AdminDashboardHandler(db *sql.DB) http.HandlerFunc {
|
||||
return helpers.AuthMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
||||
// userID, ok := helpers.GetCurrentUserID(r)
|
||||
// userID, ok := securityHelpers.GetCurrentUserID(r)
|
||||
// if !ok {
|
||||
// http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
// return
|
||||
@@ -19,7 +20,7 @@ func AdminDashboardHandler(db *sql.DB) http.HandlerFunc {
|
||||
|
||||
// TODO: check is_admin from users table here
|
||||
|
||||
context := helpers.TemplateContext(w, r, models.TemplateData{})
|
||||
context := templateHelpers.TemplateContext(w, r, models.TemplateData{})
|
||||
|
||||
// Total ticket stats
|
||||
var total, winners int
|
||||
@@ -54,7 +55,7 @@ func AdminDashboardHandler(db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
context["MatchLogs"] = logs
|
||||
|
||||
tmpl := helpers.LoadTemplateFiles("dashboard.html", "templates/admin/dashboard.html")
|
||||
tmpl := templateHelpers.LoadTemplateFiles("dashboard.html", "templates/admin/dashboard.html")
|
||||
|
||||
err = tmpl.ExecuteTemplate(w, "layout", context)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user