From ac4ff88adb9a2526555757f8d4e65c69cafb3788 Mon Sep 17 00:00:00 2001 From: r Date: Thu, 26 Dec 2019 09:11:24 +0000 Subject: Add liked by and retweeted by page --- service/transport.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'service/transport.go') diff --git a/service/transport.go b/service/transport.go index 438b39d..d4011db 100644 --- a/service/transport.go +++ b/service/transport.go @@ -98,6 +98,28 @@ func NewHandler(s Service, staticDir string) http.Handler { } }).Methods(http.MethodGet) + r.HandleFunc("/likedby/{id}", func(w http.ResponseWriter, req *http.Request) { + ctx := getContextWithSession(context.Background(), req) + id, _ := mux.Vars(req)["id"] + + err := s.ServeLikedByPage(ctx, w, nil, id) + if err != nil { + s.ServeErrorPage(ctx, w, err) + return + } + }).Methods(http.MethodGet) + + r.HandleFunc("/retweetedby/{id}", func(w http.ResponseWriter, req *http.Request) { + ctx := getContextWithSession(context.Background(), req) + id, _ := mux.Vars(req)["id"] + + err := s.ServeRetweetedByPage(ctx, w, nil, id) + if err != nil { + s.ServeErrorPage(ctx, w, err) + return + } + }).Methods(http.MethodGet) + r.HandleFunc("/like/{id}", func(w http.ResponseWriter, req *http.Request) { ctx := getContextWithSession(context.Background(), req) id, _ := mux.Vars(req)["id"] -- cgit v1.2.3