Browse Source

fix(Admin Stations): no stations loaded

Kristian Vos 5 years ago
parent
commit
68abedbb97
2 changed files with 8 additions and 2 deletions
  1. 3 2
      frontend/components/Admin/Stations.vue
  2. 5 0
      frontend/store/modules/admin.js

+ 3 - 2
frontend/components/Admin/Stations.vue

@@ -201,7 +201,7 @@ export default {
 		};
 	},
 	computed: {
-		...mapState("admin/station", {
+		...mapState("admin/stations", {
 			stations: state => state.stations
 		}),
 		...mapState("modals", {
@@ -331,13 +331,14 @@ export default {
 		},
 		init() {
 			this.socket.emit("stations.index", data => {
-				this.stations = data.stations;
+				this.loadStations(data.stations);
 			});
 			this.socket.emit("apis.joinAdminRoom", "stations", () => {});
 		},
 		...mapActions("modals", ["openModal"]),
 		...mapActions("admin/stations", [
 			"editStation",
+			"loadStations",
 			"stationRemoved",
 			"stationAdded"
 		])

+ 5 - 0
frontend/store/modules/admin.js

@@ -109,6 +109,8 @@ const modules = {
 		actions: {
 			editStation: ({ commit }, station) =>
 				commit("editStation", station),
+			loadStations: ({ commit }, stations) =>
+				commit("loadStations", stations),
 			stationRemoved: ({ commit }, stationId) =>
 				commit("stationRemoved", stationId),
 			stationAdded: ({ commit }, station) =>
@@ -119,6 +121,9 @@ const modules = {
 				state.station = station;
 				state.editing = JSON.parse(JSON.stringify(station));
 			},
+			loadStations(state, stations) {
+				state.stations = stations;
+			},
 			stationAdded(state, station) {
 				state.stations.push(station);
 			},