|
@@ -62,16 +62,19 @@
|
|
|
isEditable() ||
|
|
|
(playlist.type === 'genre' && isAdmin())
|
|
|
"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
/>
|
|
|
<add-songs
|
|
|
class="tab"
|
|
|
v-show="tab === 'add-songs'"
|
|
|
v-if="isEditable()"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
/>
|
|
|
<import-playlists
|
|
|
class="tab"
|
|
|
v-show="tab === 'import-playlists'"
|
|
|
v-if="isEditable()"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -247,6 +250,7 @@ import { mapState, mapGetters, mapActions } from "vuex";
|
|
|
import draggable from "vuedraggable";
|
|
|
import Toast from "toasters";
|
|
|
|
|
|
+import { mapModalState, mapModalActions } from "@/vuex_helpers";
|
|
|
import ws from "@/ws";
|
|
|
import SongItem from "../../SongItem.vue";
|
|
|
|
|
@@ -264,6 +268,9 @@ export default {
|
|
|
AddSongs,
|
|
|
ImportPlaylists
|
|
|
},
|
|
|
+ props: {
|
|
|
+ modalUuid: { type: String, default: "" }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
utils,
|
|
@@ -276,20 +283,19 @@ export default {
|
|
|
...mapState("station", {
|
|
|
station: state => state.station
|
|
|
}),
|
|
|
- ...mapState("user/playlists", {
|
|
|
- editing: state => state.editing
|
|
|
- }),
|
|
|
- ...mapState("modals/editPlaylist", {
|
|
|
+ ...mapModalState("modals/editPlaylist/MODAL_UUID", {
|
|
|
+ playlistId: state => state.playlistId,
|
|
|
tab: state => state.tab,
|
|
|
playlist: state => state.playlist
|
|
|
}),
|
|
|
playlistSongs: {
|
|
|
get() {
|
|
|
- return this.$store.state.modals.editPlaylist.playlist.songs;
|
|
|
+ return this.$store.state.modals.editPlaylist[this.modalUuid]
|
|
|
+ .playlist.songs;
|
|
|
},
|
|
|
set(value) {
|
|
|
this.$store.commit(
|
|
|
- "modals/editPlaylist/updatePlaylistSongs",
|
|
|
+ `modals/editPlaylist/${this.modalUuid}/updatePlaylistSongs`,
|
|
|
value
|
|
|
);
|
|
|
}
|
|
@@ -364,16 +370,26 @@ export default {
|
|
|
},
|
|
|
beforeUnmount() {
|
|
|
this.clearPlaylist();
|
|
|
+ // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
|
|
|
+ this.$store.unregisterModule([
|
|
|
+ "modals",
|
|
|
+ "editPlaylist",
|
|
|
+ this.modalUuid
|
|
|
+ ]);
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.gettingSongs = true;
|
|
|
- this.socket.dispatch("playlists.getPlaylist", this.editing, res => {
|
|
|
- if (res.status === "success") {
|
|
|
- this.setPlaylist(res.data.playlist);
|
|
|
- } else new Toast(res.message);
|
|
|
- this.gettingSongs = false;
|
|
|
- });
|
|
|
+ this.socket.dispatch(
|
|
|
+ "playlists.getPlaylist",
|
|
|
+ this.playlistId,
|
|
|
+ res => {
|
|
|
+ if (res.status === "success") {
|
|
|
+ this.setPlaylist(res.data.playlist);
|
|
|
+ } else new Toast(res.message);
|
|
|
+ this.gettingSongs = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
isEditable() {
|
|
|
return (
|
|
@@ -566,10 +582,13 @@ export default {
|
|
|
this.$refs[`${payload}-tab`].scrollIntoView({
|
|
|
block: "nearest"
|
|
|
});
|
|
|
- return dispatch("modals/editPlaylist/showTab", payload);
|
|
|
+ return dispatch(
|
|
|
+ `modals/editPlaylist/${this.modalUuid}/showTab`,
|
|
|
+ payload
|
|
|
+ );
|
|
|
}
|
|
|
}),
|
|
|
- ...mapActions("modals/editPlaylist", [
|
|
|
+ ...mapModalActions("modals/editPlaylist/MODAL_UUID", [
|
|
|
"setPlaylist",
|
|
|
"clearPlaylist",
|
|
|
"addSong",
|