mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
client: fix sending multiple requests
on songlist click
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
import { ref } from "@vue/reactivity";
|
||||
|
||||
const current = ref({
|
||||
title: "Nothing played yet",
|
||||
artists: ["... blah blah blah"],
|
||||
});
|
||||
|
||||
const next = ref({
|
||||
title: "Next song shows here",
|
||||
artists: ["... blah blah blah"],
|
||||
});
|
||||
|
||||
const queue = ref([
|
||||
{
|
||||
title: "Nothing played yet",
|
||||
artists: ["... blah blah blah"],
|
||||
_id: {
|
||||
$oid: ""
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
const putCommas = (artists) => {
|
||||
let result = [];
|
||||
|
||||
@@ -12,4 +34,29 @@ const putCommas = (artists) => {
|
||||
return result;
|
||||
};
|
||||
|
||||
export default putCommas;
|
||||
const doThat = (songs, current) => {
|
||||
queue.value = songs;
|
||||
current.value = current;
|
||||
|
||||
console.log(queue.value);
|
||||
};
|
||||
|
||||
const readQueue = () => {
|
||||
const prev_queue = JSON.parse(localStorage.getItem("queue"));
|
||||
const last_played = JSON.parse(localStorage.getItem("current"));
|
||||
const next_ = JSON.parse(localStorage.getItem("next"));
|
||||
|
||||
if (last_played){
|
||||
current.value = last_played;
|
||||
}
|
||||
|
||||
if (prev_queue){
|
||||
queue.value = prev_queue;
|
||||
}
|
||||
|
||||
if (next_){
|
||||
next.value = next_;
|
||||
}
|
||||
}
|
||||
|
||||
export default { putCommas, doThat, readQueue, current, queue, next };
|
||||
|
||||
Reference in New Issue
Block a user