Browse Source

fix(reports modal): state shouldn't be directly modified

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 5 years ago
parent
commit
a026b747c5

+ 14 - 8
frontend/components/Modals/Report.vue

@@ -144,7 +144,12 @@
 			<a
 				class="button is-danger"
 				href="#"
-				@click="$parent.modals.report = !$parent.modals.report"
+				@click="
+					closeModal({
+						sector: 'station',
+						modal: 'report'
+					})
+				"
 			>
 				<span>&nbsp;Cancel</span>
 			</a>
@@ -153,6 +158,8 @@
 </template>
 
 <script>
+import { mapActions } from "vuex";
+
 import { Toast } from "vue-roaster";
 import Modal from "./Modal.vue";
 import io from "../../io";
@@ -222,7 +229,10 @@ export default {
 			_this.socket.emit("reports.create", _this.report, res => {
 				Toast.methods.addToast(res.message, 4000);
 				if (res.status == "success")
-					_this.$parent.modals.report = !_this.$parent.modals.report;
+					_this.closeModal({
+						sector: "station",
+						modal: "report"
+					});
 			});
 		},
 		updateCharactersRemaining: function() {
@@ -251,12 +261,8 @@ export default {
 					} else this.report.issues[z].reasons.push(reason);
 				}
 			}
-		}
-	},
-	events: {
-		closeModal: function() {
-			this.$parent.modals.report = !this.$parent.modals.report;
-		}
+		},
+		...mapActions("modals", ["closeModal"])
 	}
 };
 </script>

+ 3 - 7
frontend/components/Station/CommunityHeader.vue

@@ -9,7 +9,7 @@
 				>
 					<img
 						:src="`${this.siteSettings.logo}`"
-						:alt="`${this.siteSettings.siteName}`"
+						:alt="`${this.siteSettings.siteName}` || `Musare`"
 					/>
 				</router-link>
 			</div>
@@ -213,12 +213,8 @@ export default {
 		};
 	},
 	mounted: function() {
-		lofig.get("frontendDomain", res => {
-			this.frontendDomain = res;
-		});
-		lofig.get("siteSettings", res => {
-			this.siteSettings = res;
-		});
+		lofig.get("frontendDomain", res => (this.frontendDomain = res));
+		lofig.get("siteSettings", res => (this.siteSettings = res));
 	},
 	methods: {
 		isOwner: function() {

+ 3 - 7
frontend/components/Station/OfficialHeader.vue

@@ -5,7 +5,7 @@
 				<router-link class="nav-item is-brand" to="/">
 					<img
 						:src="`${this.siteSettings.logo}`"
-						:alt="`${this.siteSettings.siteName}`"
+						:alt="`${this.siteSettings.siteName}` || `Musare`"
 					/>
 				</router-link>
 			</div>
@@ -234,12 +234,8 @@ export default {
 		};
 	},
 	mounted: function() {
-		lofig.get("frontendDomain", res => {
-			this.frontendDomain = res;
-		});
-		lofig.get("siteSettings", res => {
-			this.siteSettings = res;
-		});
+		lofig.get("frontendDomain", res => (this.frontendDomain = res));
+		lofig.get("siteSettings", res => (this.siteSettings = res));
 	},
 	methods: {
 		isOwner: function() {