aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/app/list/show.go')
-rw-r--r--pkg/app/list/show.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/pkg/app/list/show.go b/pkg/app/list/show.go
index d90f236..5231b5b 100644
--- a/pkg/app/list/show.go
+++ b/pkg/app/list/show.go
@@ -1,6 +1,7 @@
package list
import (
+ "archives/pkg/cache"
"archives/pkg/database"
"archives/pkg/models"
"github.com/go-pg/pg/v10/orm"
@@ -9,9 +10,17 @@ import (
)
func Show(w http.ResponseWriter, r *http.Request) {
-
listName := strings.ReplaceAll(r.URL.Path, "/", "")
+ templateData := cache.Get("/" + listName + "/")
+ if templateData == nil {
+ http.NotFound(w,r)
+ return
+ }
+ renderShowTemplate(w, listName, templateData)
+}
+
+func ComputeShowTemplateData(listName string) interface{} {
var res []struct {
CombinedDate string
MessageCount int
@@ -36,9 +45,7 @@ func Show(w http.ResponseWriter, r *http.Request) {
Select(&res)
if err != nil {
- http.NotFound(w, r)
- return
+ return nil
}
-
- renderShowTemplate(w, listName, res)
-}
+ return res
+} \ No newline at end of file