Files
swingmusic-extended/src/stores/pages/folder.ts
T
geoffrey45 c562e529fd implement clearing search input on start typing
+ rename pages folder to fetch in composables folder
2022-08-02 23:58:05 +03:00

20 lines
482 B
TypeScript

import { defineStore } from "pinia";
import { Folder, Track } from "../../interfaces";
import fetchThem from "../../composables/fetch/folders";
export default defineStore("FolderDirs&Tracks", {
state: () => ({
path: <string>{},
dirs: <Folder[]>[],
tracks: <Track[]>[],
}),
actions: {
async fetchAll(path: string) {
const { tracks, folders } = await fetchThem(path);
[this.path, this.dirs, this.tracks] = [path, folders, tracks];
},
},
});