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>
26 lines
812 B
TypeScript
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;
|
|
}
|