feat: implement find_all method in ChannelRepository and update related services and routes for public access

This commit is contained in:
2026-03-11 21:29:33 +01:00
parent d7b21120c8
commit 8cc3439d2e
7 changed files with 44 additions and 27 deletions

View File

@@ -9,8 +9,8 @@ export function useChannels() {
const { token } = useAuthContext();
return useQuery({
queryKey: ["channels"],
queryFn: () => api.channels.list(token!),
enabled: !!token,
// Public endpoint — no token needed for TV viewing
queryFn: () => api.channels.list(token ?? ""),
});
}
@@ -85,8 +85,8 @@ export function useCurrentBroadcast(channelId: string) {
const { token } = useAuthContext();
return useQuery({
queryKey: ["broadcast", channelId],
queryFn: () => api.schedule.getCurrentBroadcast(channelId, token!),
enabled: !!token && !!channelId,
queryFn: () => api.schedule.getCurrentBroadcast(channelId, token ?? ""),
enabled: !!channelId,
refetchInterval: 30_000,
retry: false,
});
@@ -96,7 +96,7 @@ export function useEpg(channelId: string, from?: string, until?: string) {
const { token } = useAuthContext();
return useQuery({
queryKey: ["epg", channelId, from, until],
queryFn: () => api.schedule.getEpg(channelId, token!, from, until),
enabled: !!token && !!channelId,
queryFn: () => api.schedule.getEpg(channelId, token ?? "", from, until),
enabled: !!channelId,
});
}