mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
client: request folder lists from server
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { ref } from "@vue/reactivity";
|
||||
|
||||
let home_url = "http://127.0.0.1:9876";
|
||||
|
||||
const getData = async (path) => {
|
||||
const songs = ref(null);
|
||||
const folders = ref(null);
|
||||
|
||||
const res = await fetch(`${home_url}/?f=${path}`);
|
||||
|
||||
if (!res.ok) {
|
||||
const message = `An erro has occured: ${res.status}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
songs.value = data.songs;
|
||||
folders.value = data.folders;
|
||||
|
||||
return { songs, folders };
|
||||
};
|
||||
|
||||
export default getData;
|
||||
@@ -1,17 +0,0 @@
|
||||
const scrollLeftX = (artists_dom) => {
|
||||
const dom = artists_dom.value;
|
||||
dom.scrollBy({
|
||||
left: -700,
|
||||
behavior: "smooth",
|
||||
});
|
||||
};
|
||||
|
||||
const scrollRightX = (artists_dom) => {
|
||||
const dom = artists_dom.value;
|
||||
dom.scrollBy({
|
||||
left: 700,
|
||||
behavior: "smooth",
|
||||
});
|
||||
};
|
||||
|
||||
export { scrollLeftX, scrollRightX, };
|
||||
Reference in New Issue
Block a user