Przeglądaj źródła

fix: vuex_helpers would throw warning due to accessing sometimes non-existent property

Kristian Vos 2 lat temu
rodzic
commit
112e7f22e1
1 zmienionych plików z 12 dodań i 2 usunięć
  1. 12 2
      frontend/src/vuex_helpers.js

+ 12 - 2
frontend/src/vuex_helpers.js

@@ -6,7 +6,12 @@ const mapModalState = (namespace, map) => {
 		modalState[mapKey] = function func() {
 			return mapValue(
 				namespace
-					.replace("MODAL_MODULE_PATH", this.modalModulePath)
+					.replace(
+						"MODAL_MODULE_PATH",
+						namespace.indexOf("MODAL_MODULE_PATH") !== -1
+							? this.modalModulePath
+							: null
+					)
 					.replace("MODAL_UUID", this.modalUuid)
 					.split("/")
 					.reduce((a, b) => a[b], this.$store.state)
@@ -22,7 +27,12 @@ const mapModalActions = (namespace, map) => {
 		modalState[mapValue] = function func(value) {
 			return this.$store.dispatch(
 				`${namespace
-					.replace("MODAL_MODULE_PATH", this.modalModulePath)
+					.replace(
+						"MODAL_MODULE_PATH",
+						namespace.indexOf("MODAL_MODULE_PATH") !== -1
+							? this.modalModulePath
+							: null
+					)
 					.replace("MODAL_UUID", this.modalUuid)}/${mapValue}`,
 				value
 			);