From f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f Mon Sep 17 00:00:00 2001 From: r Date: Sun, 15 Dec 2019 17:37:58 +0000 Subject: Add notification support --- service/transport.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'service/transport.go') 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")) -- cgit v1.2.3