Backend: Added PUT /seasons/:id/refresh endpoint that fetches updated TMDB data for a single season. Frontend: - New SeasonRatingDialog for rating seasons via StarRating - useRefreshSeason and useUpdateSeason hooks with query invalidation - SeasonPage now shows inline season rating (user + TMDB) - Mark Watched, Rate, and Refresh actions moved under a dropdown menu
24 lines
755 B
TypeScript
24 lines
755 B
TypeScript
import { api } from "@/lib/api";
|
|
import type { Season, Episode } from "@/types";
|
|
|
|
export const seasonsApi = {
|
|
getAll: () => api.get<Season[]>("/seasons").then((r) => r.data),
|
|
|
|
getById: (id: number) =>
|
|
api.get<Season>(`/seasons/${id}`).then((r) => r.data),
|
|
|
|
getEpisodes: (id: number) =>
|
|
api.get<Episode[]>(`/seasons/${id}/episodes`).then((r) => r.data),
|
|
|
|
create: (data: Partial<Season>) =>
|
|
api.post<Season>("/seasons", data).then((r) => r.data),
|
|
|
|
update: (id: number, data: Partial<Season>) =>
|
|
api.put<Season>(`/seasons/${id}`, data).then((r) => r.data),
|
|
|
|
delete: (id: number) => api.delete(`/seasons/${id}`).then((r) => r.data),
|
|
|
|
refresh: (id: number) =>
|
|
api.put<Season>(`/seasons/${id}/refresh`).then((r) => r.data),
|
|
};
|