diff --git a/src/components/vue/PlaylistSearchInput.vue b/src/components/vue/PlaylistSearchInput.vue index 83ab385..5a6b11b 100644 --- a/src/components/vue/PlaylistSearchInput.vue +++ b/src/components/vue/PlaylistSearchInput.vue @@ -15,7 +15,7 @@ const searchHistory = ref( JSON.parse(localStorage.getItem('searchHistory') || '[]') ); -const playlists = ref([]); +const playlistRegistry = ref([]); const searchSuggestions = ref(searchHistory.value); const isFetchingPlaylists = ref(true); @@ -49,7 +49,7 @@ const fetchAvailablePlaylists = async () => { return { name, id }; }); - playlists.value = playlistEntries; + playlistRegistry.value = playlistEntries; } catch (error) { console.error(error); errorOccurred.value = true; @@ -65,7 +65,6 @@ const findMatchingPlaylists = debounce(async (name: string) => { if (name.length === 0) return showSearchHistory(); else if (name.length < 3) return (searchSuggestions.value = []); - // Assume the name is a valid playlist URL const playlistId = getPlaylistIdFromUrl(name); const githubResponse = await fetch( `https://raw.githubusercontent.com/mackorone/spotify-playlist-archive/main/playlists/pretty/${playlistId}.json` @@ -85,7 +84,7 @@ const findMatchingPlaylists = debounce(async (name: string) => { return (searchSuggestions.value = []); } - const matches = search(name, playlists.value, { + const matches = search(name, playlistRegistry.value, { keySelector: (obj) => obj.name }); @@ -116,7 +115,7 @@ watch(searchTerm, (newSearchTerm) => findMatchingPlaylists(newSearchTerm)); >
- Failed to fetch available playlists + Failed to load playlist registry