Files
ersatztv/web/src/api/playlists.ts
T
timothyandClaude Fable 5 a52939f292 feat(web): Decos screen (list + 6-section editor) on the REST API (#144 S3 (#162))
Adds the /app/decos screen (dual-mode list/editor) mirroring the legacy Blazor
deco form: deco/watermark/graphics/break-content/default-filler/dead-air
sections with mode-gated controls, watermark/graphics multi-selects, break
content with a playlist group->playlist cascade and per-placement uniqueness,
and default-filler/dead-air typeahead pickers. Adds decos/playlists api modules,
artist/multi-collection search wrappers, and regenerated types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 19:22:49 +02:00

26 lines
812 B
TypeScript

import { ApiError, request } from './client';
import type { components } from './generated/v1';
export type PlaylistGroup = components['schemas']['PlaylistGroupResponseModel'];
export type Playlist = components['schemas']['PlaylistResponseModel'];
export function getPlaylistGroups(): Promise<PlaylistGroup[]> {
return request<PlaylistGroup[]>('/api/playlists/groups');
}
export function getPlaylists(playlistGroupId: number): Promise<Playlist[]> {
return request<Playlist[]>(`/api/playlists?playlistGroupId=${playlistGroupId}`);
}
export function messageFromPlaylistError(error: unknown, fallback = 'Unable to load playlists'): string {
if (error instanceof ApiError) {
return error.detail ?? error.message;
}
if (error instanceof Error) {
return error.message;
}
return fallback;
}