Implemented the new react version of the frontend

This commit is contained in:
Mohammed Abad committed 2026-03-31 01:56:38 +01:00
1 parent 236e6e06fb
commit ffe7e52527
65 files changed
+5228 -177

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { useQuery } from '@tanstack/react-query';
import { seasonsApi } from '@/api/seasons';
export const seasonKeys = {
all: ['seasons'] as const,
detail: (id: number) => ['seasons', id] as const,
episodes: (id: number) => ['seasons', id, 'episodes'] as const,
};
export function useSeason(id: number) {
return useQuery({
queryKey: seasonKeys.detail(id),
queryFn: () => seasonsApi.getById(id),
enabled: !!id,
});
}
export function useSeasonEpisodes(id: number) {
return useQuery({
queryKey: seasonKeys.episodes(id),
queryFn: () => seasonsApi.getEpisodes(id),
enabled: !!id,
});
}