feat: added playlist option
All checks were successful
Build and Push Docker Image / docker (push) Successful in 10s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 10s
This commit is contained in:
@@ -4,10 +4,28 @@ import { onMessage } from './handlers.js';
|
||||
import { wireUi } from './ui.js';
|
||||
import { $nameLobby } from './dom.js';
|
||||
|
||||
// Fetch and store available playlists
|
||||
async function loadPlaylists() {
|
||||
try {
|
||||
const response = await fetch('/api/playlists');
|
||||
const data = await response.json();
|
||||
if (data.ok && data.playlists) {
|
||||
state.playlists = data.playlists;
|
||||
return data.playlists;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load playlists:', error);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
// Initialize UI and open WebSocket connection
|
||||
wireUi();
|
||||
connectWS(onMessage);
|
||||
|
||||
// Load playlists on startup
|
||||
loadPlaylists();
|
||||
|
||||
// Restore name/id immediately for initial render smoothness
|
||||
(() => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user