mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
48 lines
980 B
JavaScript
48 lines
980 B
JavaScript
import Router from "@/router";
|
|
|
|
import album from "./album.js";
|
|
import state from "./state";
|
|
|
|
async function toAlbum(title, artist) {
|
|
console.log("routing to album");
|
|
|
|
state.loading.value = true;
|
|
await album
|
|
.getAlbumTracks(title, artist)
|
|
.then((data) => {
|
|
state.album.tracklist = data.songs;
|
|
state.album.info = data.info;
|
|
})
|
|
.then(
|
|
await album.getAlbumArtists(title, artist).then((data) => {
|
|
state.album.artists = data;
|
|
})
|
|
)
|
|
.then(
|
|
album.getAlbumBio(title, artist).then((data) => {
|
|
if (data === "None") {
|
|
state.album.bio = null;
|
|
} else {
|
|
state.album.bio = data;
|
|
}
|
|
})
|
|
)
|
|
.then(() => {
|
|
Router.push({
|
|
name: "AlbumView",
|
|
params: {
|
|
album: title,
|
|
artist: artist,
|
|
},
|
|
});
|
|
state.loading.value = false;
|
|
})
|
|
.catch((error) => {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
export default {
|
|
toAlbum,
|
|
};
|