mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
major refactors
- remove jpgs - add new album header - remove duplicate components - display album bio on client - add a route loader module - change color scheme - other minor changes
This commit is contained in:
@@ -38,7 +38,27 @@ const getAlbumArtists = async (name, artist) => {
|
||||
return data.artists;
|
||||
};
|
||||
|
||||
const getAlbumBio = async(name, artist) => {
|
||||
const res = await fetch(
|
||||
base_uri +
|
||||
"/album/" +
|
||||
encodeURIComponent(name.replaceAll("/", "|")) +
|
||||
"/" +
|
||||
encodeURIComponent(artist.replaceAll("/", "|")) +
|
||||
"/bio"
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
const message = `An error has occured: ${res.status}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
return data.bio;
|
||||
};
|
||||
|
||||
export default {
|
||||
getAlbumTracks,
|
||||
getAlbumArtists,
|
||||
getAlbumBio
|
||||
};
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import Router from "@/router";
|
||||
|
||||
import album from "./album.js";
|
||||
import state from "./state.js";
|
||||
|
||||
function toAlbum(title, artist) {
|
||||
album
|
||||
.getAlbumTracks(title, artist)
|
||||
.then((data) => {
|
||||
state.album_song_list.value = data.songs;
|
||||
state.album_info.value = data.info;
|
||||
})
|
||||
.then(
|
||||
album.getAlbumArtists(title, artist).then((data) => {
|
||||
state.album_artists.value = data;
|
||||
})
|
||||
)
|
||||
.then(
|
||||
album.getAlbumBio(title, artist).then((data) => {
|
||||
if (data == "None") {
|
||||
state.album_bio.value = null;
|
||||
} else {
|
||||
state.album_bio.value = data;
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(
|
||||
Router.push({
|
||||
name: "AlbumView",
|
||||
params: {
|
||||
album: title,
|
||||
artist: artist,
|
||||
},
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
toAlbum,
|
||||
};
|
||||
@@ -36,6 +36,8 @@ const prev = ref({
|
||||
const album_song_list = ref([]);
|
||||
const album_info = ref([]);
|
||||
const album_artists = ref([]);
|
||||
const album_bio = ref("");
|
||||
|
||||
const filters = ref([]);
|
||||
|
||||
const magic_flag = ref(false);
|
||||
@@ -64,4 +66,5 @@ export default {
|
||||
album_song_list,
|
||||
album_info,
|
||||
album_artists,
|
||||
album_bio,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user