diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-10-11 22:47:16 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-10-11 22:47:39 +0200 |
commit | b46012f212a4302b4d1325d8fdf9634e7083e76a (patch) | |
tree | 095d00491c385c33674f5a0a11128a543a48c485 /main.go | |
parent | e79d3d7163657f7a540530dddb319f984885e864 (diff) | |
download | gosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.tar.gz gosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.tar.bz2 gosten-b46012f212a4302b4d1325d8fdf9634e7083e76a.zip |
First draft of recurrent costs and categories
Diffstat (limited to '')
-rw-r--r-- | main.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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) |