방선주 방선주 2023-03-02
230302 방선주 대상자 등록 시 얼럿노출 적용
@faef21b3d6efabb32ee7b5647fdd0760ac7294f8
client/views/component/Modal_SeniorInsert.jsx
--- client/views/component/Modal_SeniorInsert.jsx
+++ client/views/component/Modal_SeniorInsert.jsx
@@ -64,27 +64,32 @@
   //-------- 등록 버튼 동작 수행 영역 시작 --------//
   // 대상자 정보 등록을 위한 함수 
   const InsertUserData = () => {
-    fetch("/user/insertSeniorData.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify({
-        user_name: userName,
-        user_gender: gender,
-        user_birth: brith,
-        user_phonenumber: telNum,
-        user_address: homeAddress,
-        agency_id: 'agency01',
-        government_id: 'government01',
-        user_code: '4',
-      }),
-    }).then((response) => response.json()).then((data) => {
-      console.log("대상자 정보 등록");
-      InsertUserPillData();
-    }).catch((error) => {
-      console.log('insertSeniorData() /user/insertSeniorData.json error : ', error);
-    });
+    var insertBtn = confirm("등록하시겠습니까?");
+    if (insertBtn) {
+      fetch("/user/insertSeniorData.json", {
+        method: "POST",
+        headers: {
+          'Content-Type': 'application/json; charset=UTF-8'
+        },
+        body: JSON.stringify({
+          user_name: userName,
+          user_gender: gender,
+          user_birth: brith,
+          user_phonenumber: telNum,
+          user_address: homeAddress,
+          agency_id: 'agency01',
+          government_id: 'government01',
+          user_code: '4',
+        }),
+      }).then((response) => response.json()).then((data) => {
+        console.log("대상자 정보 등록");
+        InsertUserPillData();
+      }).catch((error) => {
+        console.log('insertSeniorData() /user/insertSeniorData.json error : ', error);
+      });
+    } else {
+      return;
+    }
   };
   // 대상자 약 복용 정보 등록을 위한 함수 
   const InsertUserPillData = () => {
@@ -105,7 +110,9 @@
       console.log("약 정보 등록");
       dataReset();
       setAddSenior(true)
+      alert("등록 되었습니다.");
       noticeModalClose()
+
     }).catch((error) => {
       console.log('InsertUserPillData() /user/insertSeniorMadication.json error : ', error);
     });
Add a comment
List