하석형 하석형 04-03
250403 하석형 Context Path 유효성 검사 추가, 저장 후 처리 과정
@088938884a85d9b5e04649acbd146aadc8f73b91
client/views/pages/adm/system/LoginPolicy/LoginPolicy.vue
--- client/views/pages/adm/system/LoginPolicy/LoginPolicy.vue
+++ client/views/pages/adm/system/LoginPolicy/LoginPolicy.vue
@@ -174,10 +174,19 @@
           const res = await saveCntxtPth(ctx);
           alert(res.data.message);
           if (res.status == 200) {
-            store.commit("setStoreReset");
+            console.log("origin store contextPath : ", store.state.contextPath);
+            let storeCtx = this.cntxtPth;
+            if(storeCtx == '/') {
+              storeCtx = '';
+            }
+            store.commit("setContextPath", storeCtx); // 캐시 초기화 요청을 보내기 위한 Context Path 정보 저장
             const cacheRes = await cacheReSet(); // 캐시 초기화
             alert(cacheRes.data.message);
-            window.location = `${store.state.contextPath}/login.page`;
+            store.commit("setStoreReset"); // 캐시 초기화 후 Store 초기화
+            // console.log("before reload store contextPath : ", store.state.contextPath);
+            // window.location.reload(); // AppRouter 재실행을 위한 페이지 새로고침
+            // console.log("after reload store contextPath : ", store.state.contextPath);
+            window.location.href = `${storeCtx}/login.page`;
           } else {
             alert(res.data.message);
           }
@@ -195,6 +204,16 @@
         this.$refs.cntxtPth.focus();
         return false;
       }
+      if(this.cntxtPth.length > 50) {
+        alert("Context Path는 50자 이내로 입력해주세요.");
+        this.$refs.cntxtPth.focus();
+        return false;
+      }
+      if(this.cntxtPth == this.defaultCntxtPth) {
+        alert("변경된 내용이 없습니다.");
+        this.$refs.cntxtPth.focus();
+        return false;
+      }
       if(!regex.test(this.cntxtPth)) {
         alert("Context Path는 '/'로 시작해야 하며, 알파벳, 숫자, '-' 또는 '_'만 포함할 수 있습니다.");
         this.$refs.cntxtPth.focus();
Add a comment
List