client: request folder lists from server

This commit is contained in:
geoffrey45
2021-12-15 15:20:12 +03:00
parent 803c813786
commit 701f61250e
14 changed files with 111 additions and 61 deletions
+23
View File
@@ -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;
-17
View File
@@ -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, };