feat: replace notifications with continue watching
This commit is contained in:
@@ -314,51 +314,6 @@ func (h *Handler) HandleAPIDiscoverUpcoming(w http.ResponseWriter, r *http.Reque
|
||||
templates.DiscoverItems(res.Animes, "upcoming", page+1, res.HasNextPage).Render(r.Context(), w)
|
||||
}
|
||||
|
||||
func (h *Handler) HandleNotifications(w http.ResponseWriter, r *http.Request) {
|
||||
userID := userIDFromRequest(r)
|
||||
|
||||
if userID == "" {
|
||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
tab := r.URL.Query().Get("tab")
|
||||
if tab != "sequels" {
|
||||
tab = "tracking"
|
||||
}
|
||||
|
||||
var watching []templates.WatchingAnimeWithDetails
|
||||
if tab == "tracking" {
|
||||
var err error
|
||||
watching, err = h.svc.GetWatchingAnime(r.Context(), userID)
|
||||
if err != nil {
|
||||
log.Printf("watching anime error: %v", err)
|
||||
http.Error(w, "Failed to fetch watching anime", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
templates.Notifications(watching, tab).Render(r.Context(), w)
|
||||
}
|
||||
|
||||
func (h *Handler) HandleNotificationsUpcoming(w http.ResponseWriter, r *http.Request) {
|
||||
userID := userIDFromRequest(r)
|
||||
|
||||
if userID == "" {
|
||||
http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
upcomingSeasons, err := h.svc.GetUpcomingSeasons(r.Context(), userID)
|
||||
if err != nil {
|
||||
log.Printf("upcoming seasons error: %v", err)
|
||||
http.Error(w, "Failed to fetch upcoming seasons", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
templates.UpcomingSeasonsList(upcomingSeasons).Render(r.Context(), w)
|
||||
}
|
||||
|
||||
func (h *Handler) HandleStudioDetails(w http.ResponseWriter, r *http.Request) {
|
||||
idStr := r.URL.Path[len("/studios/"):]
|
||||
id, err := strconv.Atoi(idStr)
|
||||
|
||||
Reference in New Issue
Block a user