mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
add comments to some store functions
- some refactors to modals
This commit is contained in:
@@ -14,6 +14,12 @@ export default defineStore("album", {
|
||||
bio: null,
|
||||
}),
|
||||
actions: {
|
||||
/**
|
||||
* Fetches a single album information, artists and its tracks from the server
|
||||
* using the title and album-artist of the album.
|
||||
* @param title title of the album
|
||||
* @param albumartist artist of the album
|
||||
*/
|
||||
async fetchTracksAndArtists(title: string, albumartist: string) {
|
||||
const tracks = await getAlbumTracks(title, albumartist);
|
||||
const artists = await getAlbumArtists(title, albumartist);
|
||||
@@ -22,6 +28,11 @@ export default defineStore("album", {
|
||||
this.info = tracks.info;
|
||||
this.artists = artists;
|
||||
},
|
||||
/**
|
||||
* Fetches the album bio from the server
|
||||
* @param title title of the album
|
||||
* @param albumartist artist of the album
|
||||
*/
|
||||
fetchBio(title: string, albumartist: string) {
|
||||
this.bio = null;
|
||||
getAlbumBio(title, albumartist).then((bio) => {
|
||||
|
||||
+6
-2
@@ -19,9 +19,13 @@ export default defineStore("newModal", {
|
||||
this.component = modalOption;
|
||||
this.visible = true;
|
||||
},
|
||||
showNewPlaylistModal(track: Track) {
|
||||
showNewPlaylistModal(track?: Track) {
|
||||
this.component = ModalOptions.newPlaylist;
|
||||
this.props.track = track;
|
||||
|
||||
if (track) {
|
||||
this.props.track = track;
|
||||
}
|
||||
|
||||
this.visible = true;
|
||||
},
|
||||
showEditPlaylistModal(playlist: Playlist) {
|
||||
|
||||
@@ -8,11 +8,21 @@ export default defineStore("playlist-tracks", {
|
||||
tracks: <Track[]>[],
|
||||
}),
|
||||
actions: {
|
||||
/**
|
||||
* Fetches a single playlist information, and its tracks from the server
|
||||
* @param playlistid The id of the playlist to fetch
|
||||
*/
|
||||
async fetchAll(playlistid: string) {
|
||||
const playlist = await getPlaylist(playlistid);
|
||||
|
||||
this.info = playlist.info;
|
||||
this.tracks = playlist.tracks;
|
||||
},
|
||||
/**
|
||||
* Updates the playlist header info. This is used when the playlist is
|
||||
* updated.
|
||||
* @param info Playlist info
|
||||
*/
|
||||
updatePInfo(info: Playlist) {
|
||||
this.info = info;
|
||||
},
|
||||
|
||||
@@ -7,10 +7,22 @@ export default defineStore("playlists", {
|
||||
playlists: <Playlist[]>[],
|
||||
}),
|
||||
actions: {
|
||||
/**
|
||||
* Fetch all playlists from the server
|
||||
*/
|
||||
async fetchAll() {
|
||||
const playlists = await getAllPlaylists();
|
||||
|
||||
this.playlists = playlists;
|
||||
},
|
||||
/**
|
||||
* Adds a single playlist to the store
|
||||
* @param playlist Playlist to add to the store
|
||||
* @returns void
|
||||
*/
|
||||
addPlaylist(playlist: Playlist) {
|
||||
// add at the beginning
|
||||
this.playlists.unshift(playlist);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user