mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-09 12:37:22 +00:00
fix fetching playlists and creating options
This commit is contained in:
parent
6c997c8795
commit
ed4725a279
@ -1,4 +1,4 @@
|
|||||||
import { Track } from "../interfaces";
|
import { Playlist, Track } from "../interfaces";
|
||||||
import Router from "../router";
|
import Router from "../router";
|
||||||
import { Option } from "../interfaces";
|
import { Option } from "../interfaces";
|
||||||
import { getAllPlaylists } from "../composables/playlists";
|
import { getAllPlaylists } from "../composables/playlists";
|
||||||
@ -10,9 +10,22 @@ import { getAllPlaylists } from "../composables/playlists";
|
|||||||
* @return {Array<Option>()} a list of context menu items.
|
* @return {Array<Option>()} a list of context menu items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default (track: Track, modalStore: any) => {
|
export default async (track: Track, modalStore: any): Promise<Option[]> => {
|
||||||
const single_artist = track.artists.length === 1;
|
const single_artist = track.artists.length === 1;
|
||||||
|
|
||||||
|
let playlists = <Option[]>[];
|
||||||
|
|
||||||
|
const p = await getAllPlaylists();
|
||||||
|
|
||||||
|
playlists = p.map((playlist: Playlist) => {
|
||||||
|
return <Option>{
|
||||||
|
label: playlist.name,
|
||||||
|
action: () => {
|
||||||
|
console.log(playlist.name);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const goToArtist = () => {
|
const goToArtist = () => {
|
||||||
if (single_artist) {
|
if (single_artist) {
|
||||||
return false;
|
return false;
|
||||||
@ -26,18 +39,7 @@ export default (track: Track, modalStore: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
async function addToPlaylist() {
|
function addToPlaylist() {
|
||||||
const p = await getAllPlaylists();
|
|
||||||
|
|
||||||
const playlists = p.map((playlist) => {
|
|
||||||
return <Option>{
|
|
||||||
label: playlist.name,
|
|
||||||
action: () => {
|
|
||||||
console.log("playlist");
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const new_playlist = <Option>{
|
const new_playlist = <Option>{
|
||||||
label: "New playlist",
|
label: "New playlist",
|
||||||
action: () => {
|
action: () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user