diff options
author | r <r@freesoftwareextremist.com> | 2019-12-15 17:37:58 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2019-12-15 17:37:58 +0000 |
commit | f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f (patch) | |
tree | 301e89bb8ebb56b9756fe322eb9ad953bac2661e /service/transport.go | |
parent | 51a4b16af518fde883df50f7f627fda21c18065e (diff) | |
download | bloat-f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f.tar.gz bloat-f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f.zip |
Add notification support
Diffstat (limited to 'service/transport.go')
-rw-r--r-- | service/transport.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/service/transport.go b/service/transport.go index d5a6ee8..377ab23 100644 --- a/service/transport.go +++ b/service/transport.go @@ -179,6 +179,19 @@ func NewHandler(s Service, staticDir string) http.Handler { w.WriteHeader(http.StatusSeeOther) }).Methods(http.MethodPost) + r.HandleFunc("/notifications", func(w http.ResponseWriter, req *http.Request) { + ctx := getContextWithSession(context.Background(), req) + + maxID := req.URL.Query().Get("max_id") + minID := req.URL.Query().Get("min_id") + + err := s.ServeNotificationPage(ctx, w, nil, maxID, minID) + if err != nil { + s.ServeErrorPage(ctx, w, err) + return + } + }).Methods(http.MethodGet) + r.HandleFunc("/signout", func(w http.ResponseWriter, req *http.Request) { // TODO remove session from database w.Header().Add("Set-Cookie", fmt.Sprintf("session_id=;max-age=0")) |