From b46012f212a4302b4d1325d8fdf9634e7083e76a Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 11 Oct 2024 22:47:16 +0200 Subject: First draft of recurrent costs and categories --- main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 84dcd6e..29c85da 100644 --- a/main.go +++ b/main.go @@ -64,6 +64,8 @@ func main() { // handlers that required authentification authMux.Handle("GET /{$}", indexPage()) + authMux.Handle("GET /recur/{$}", recurPage()) + authMux.Handle("GET /categories/{$}", categoriesPage()) authMux.Handle("GET /", notfound()) log.Fatal(http.ListenAndServe(os.Getenv("GOSTEN_ADDRESS"), handler)) @@ -83,6 +85,22 @@ func indexPage() http.HandlerFunc { } } +func recurPage() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + uid := userId(r) + exps, _ := Q.GetRecurExpenses(r.Context(), uid) + showTemplate(w, "recur", exps) + } +} + +func categoriesPage() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + uid := userId(r) + cats, _ := Q.GetCategories(r.Context(), uid) + showTemplate(w, "categories", cats) + } +} + func notfound() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { showTemplate(w, "404", r.RequestURI) -- cgit v1.2.3-70-g09d2 sten.git/log/pages/pages.go?follow=1'>logtreecommitdiff
path: root/pages/pages.go (unfollow)
Commit message (Expand)AuthorFilesLines
33 hoursSave User as part of the contextRené 'Necoro' Neumann1-7/+2
33 hoursSQL: Fetch * instead of specific columns for simplicityRené 'Necoro' Neumann8-47/+40
33 hoursMove bootstrap parts to their own templRené 'Necoro' Neumann2-34/+75
33 hoursAdd User dropdownRené 'Necoro' Neumann2-9/+61
34 hoursMove from html/template to templRené 'Necoro' Neumann27-340/+1138
2 daysHandle login routing at login pageRené 'Necoro' Neumann2-16/+22
2 daysRestructure and change to chi as muxing frameworkRené 'Necoro' Neumann9-140/+197