mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
fix search to read from database
This commit is contained in:
@@ -19,7 +19,7 @@ import useSearchStore from "../../../stores/search";
|
||||
const search = useSearchStore();
|
||||
|
||||
function loadMore() {
|
||||
search.updateLoadCounter("albums", 6);
|
||||
search.updateLoadCounter("albums");
|
||||
search.loadAlbums(search.loadCounter.albums);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -19,7 +19,7 @@ import useSearchStore from "../../../stores/search";
|
||||
const search = useSearchStore();
|
||||
|
||||
function loadMore() {
|
||||
search.updateLoadCounter("artists", 6);
|
||||
search.updateLoadCounter("artists");
|
||||
search.loadArtists(search.loadCounter.artists);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -26,7 +26,7 @@ const queue = useQStore();
|
||||
const search = useSearchStore();
|
||||
|
||||
function loadMore() {
|
||||
search.updateLoadCounter("tracks", 5);
|
||||
search.updateLoadCounter("tracks");
|
||||
search.loadTracks(search.loadCounter.tracks);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ async function searchTracks(query: string) {
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
console.log(data)
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -123,16 +123,16 @@ export default defineStore("search", () => {
|
||||
.then(() => scrollOnLoad());
|
||||
}
|
||||
|
||||
function updateLoadCounter(type: string, value: number) {
|
||||
function updateLoadCounter(type: string) {
|
||||
switch (type) {
|
||||
case "tracks":
|
||||
loadCounter.tracks += value;
|
||||
loadCounter.tracks += 6;
|
||||
break;
|
||||
case "albums":
|
||||
loadCounter.albums += value;
|
||||
loadCounter.albums += 6;
|
||||
break;
|
||||
case "artists":
|
||||
loadCounter.artists += value;
|
||||
loadCounter.artists += 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user