2024-05-02 23:16:28 +07:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/tigorlazuardi/redmage/pkg/log"
|
|
|
|
"github.com/tigorlazuardi/redmage/views"
|
2024-05-27 21:10:37 +07:00
|
|
|
"github.com/tigorlazuardi/redmage/views/subreddits/put"
|
2024-05-02 23:16:28 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
func (routes *Routes) PageSubredditsAdd(rw http.ResponseWriter, r *http.Request) {
|
|
|
|
ctx, span := tracer.Start(r.Context(), "Routes.PageSubredditsAdd")
|
|
|
|
defer span.End()
|
|
|
|
|
|
|
|
c := views.NewContext(routes.Config, r)
|
|
|
|
|
2024-05-28 00:30:29 +07:00
|
|
|
data := put.Data{
|
|
|
|
Title: "Add Subreddit",
|
|
|
|
PostAction: "/htmx/subreddits/add",
|
|
|
|
}
|
2024-05-27 21:10:37 +07:00
|
|
|
|
|
|
|
if err := put.View(c, data).Render(ctx, rw); err != nil {
|
2024-05-02 23:16:28 +07:00
|
|
|
log.New(ctx).Err(err).Error("failed to render subreddits add page")
|
|
|
|
}
|
|
|
|
}
|