no interval or timeout
This commit is contained in:
@@ -17,11 +17,6 @@ export const useSongsStore = defineStore("songs", () => {
|
|||||||
|
|
||||||
const songsCount = computed(() => songs.value.length);
|
const songsCount = computed(() => songs.value.length);
|
||||||
|
|
||||||
fetchSongs();
|
|
||||||
|
|
||||||
let refreshId = null;
|
|
||||||
refreshId = setTimeout(fetchSongs, 120000);
|
|
||||||
|
|
||||||
async function fetchSongs() {
|
async function fetchSongs() {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get("/api/spotify/recent");
|
const res = await axios.get("/api/spotify/recent");
|
||||||
@@ -29,8 +24,6 @@ export const useSongsStore = defineStore("songs", () => {
|
|||||||
throw new Error("Invalid response from Spotify API");
|
throw new Error("Invalid response from Spotify API");
|
||||||
}
|
}
|
||||||
songs.value = res.data;
|
songs.value = res.data;
|
||||||
refreshId = setTimeout(fetchSongs, 120000);
|
|
||||||
console.log("lol");
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Cannot connect to Spotify API", err);
|
console.error("Cannot connect to Spotify API", err);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user