|
@@ -301,16 +301,23 @@ import io from "../../io";
|
|
import validation from "../../validation";
|
|
import validation from "../../validation";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- computed: mapState({
|
|
|
|
- editing(state) {
|
|
|
|
- return this.$props.store.split("/").reduce((a, v) => a[v], state)
|
|
|
|
- .editing;
|
|
|
|
- },
|
|
|
|
- station(state) {
|
|
|
|
- return this.$props.store.split("/").reduce((a, v) => a[v], state)
|
|
|
|
- .station;
|
|
|
|
- }
|
|
|
|
- }),
|
|
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState("admin/station", {
|
|
|
|
+ stations: state => state.stations
|
|
|
|
+ }),
|
|
|
|
+ ...mapState({
|
|
|
|
+ editing(state) {
|
|
|
|
+ return this.$props.store
|
|
|
|
+ .split("/")
|
|
|
|
+ .reduce((a, v) => a[v], state).editing;
|
|
|
|
+ },
|
|
|
|
+ station(state) {
|
|
|
|
+ return this.$props.store
|
|
|
|
+ .split("/")
|
|
|
|
+ .reduce((a, v) => a[v], state).station;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
mounted() {
|
|
mounted() {
|
|
io.getSocket(socket => {
|
|
io.getSocket(socket => {
|
|
this.socket = socket;
|
|
this.socket = socket;
|
|
@@ -422,9 +429,9 @@ export default {
|
|
if (res.status === "success") {
|
|
if (res.status === "success") {
|
|
if (this.station) this.station.name = name;
|
|
if (this.station) this.station.name = name;
|
|
else {
|
|
else {
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[index].name = name;
|
|
|
|
|
|
+ this.stations[index].name = name;
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -461,9 +468,9 @@ export default {
|
|
if (this.station)
|
|
if (this.station)
|
|
this.station.displayName = displayName;
|
|
this.station.displayName = displayName;
|
|
else {
|
|
else {
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[
|
|
|
|
|
|
+ this.stations[
|
|
index
|
|
index
|
|
].displayName = displayName;
|
|
].displayName = displayName;
|
|
return displayName;
|
|
return displayName;
|
|
@@ -506,9 +513,9 @@ export default {
|
|
if (this.station)
|
|
if (this.station)
|
|
this.station.description = description;
|
|
this.station.description = description;
|
|
else {
|
|
else {
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[
|
|
|
|
|
|
+ this.stations[
|
|
index
|
|
index
|
|
].description = description;
|
|
].description = description;
|
|
return description;
|
|
return description;
|
|
@@ -543,9 +550,9 @@ export default {
|
|
if (this.station)
|
|
if (this.station)
|
|
this.station.privacy = this.editing.privacy;
|
|
this.station.privacy = this.editing.privacy;
|
|
else {
|
|
else {
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[
|
|
|
|
|
|
+ this.stations[
|
|
index
|
|
index
|
|
].privacy = this.editing.privacy;
|
|
].privacy = this.editing.privacy;
|
|
return this.editing.privacy;
|
|
return this.editing.privacy;
|
|
@@ -575,9 +582,9 @@ export default {
|
|
JSON.stringify(this.editing.genres)
|
|
JSON.stringify(this.editing.genres)
|
|
);
|
|
);
|
|
if (this.station) this.station.genres = genres;
|
|
if (this.station) this.station.genres = genres;
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[index].genres = genres;
|
|
|
|
|
|
+ this.stations[index].genres = genres;
|
|
return genres;
|
|
return genres;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -606,9 +613,9 @@ export default {
|
|
);
|
|
);
|
|
if (this.station)
|
|
if (this.station)
|
|
this.station.blacklistedGenres = blacklistedGenres;
|
|
this.station.blacklistedGenres = blacklistedGenres;
|
|
- this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ this.stations.forEach((station, index) => {
|
|
if (station._id === this.editing._id) {
|
|
if (station._id === this.editing._id) {
|
|
- this.$parent.stations[
|
|
|
|
|
|
+ this.stations[
|
|
index
|
|
index
|
|
].blacklistedGenres = blacklistedGenres;
|
|
].blacklistedGenres = blacklistedGenres;
|
|
return blacklistedGenres;
|
|
return blacklistedGenres;
|
|
@@ -642,9 +649,9 @@ export default {
|
|
this.station.partyMode = this.editing.partyMode;
|
|
this.station.partyMode = this.editing.partyMode;
|
|
// if (this.station)
|
|
// if (this.station)
|
|
// this.station.partyMode = this.editing.partyMode;
|
|
// this.station.partyMode = this.editing.partyMode;
|
|
- // this.$parent.stations.forEach((station, index) => {
|
|
|
|
|
|
+ // this.stations.forEach((station, index) => {
|
|
// if (station._id === this.editing._id) {
|
|
// if (station._id === this.editing._id) {
|
|
- // this.$parent.stations[
|
|
|
|
|
|
+ // this.stations[
|
|
// index
|
|
// index
|
|
// ].partyMode = this.editing.partyMode;
|
|
// ].partyMode = this.editing.partyMode;
|
|
// return this.editing.partyMode;
|
|
// return this.editing.partyMode;
|