From 120aa2b1adc493a2153dcee04aa001ae00a90c94 Mon Sep 17 00:00:00 2001
From: hyunzzii <yhynym@gmail.com>
Date: Sun, 10 Dec 2023 23:52:22 +0900
Subject: [PATCH] feat: endvote modify

---
 .idea/.gitignore               |  5 +++++
 .idea/client.iml               | 12 ++++++++++++
 .idea/modules.xml              |  8 ++++++++
 .idea/vcs.xml                  |  6 ++++++
 src/components/recruit/vote.js |  7 ++++---
 5 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 .idea/.gitignore
 create mode 100644 .idea/client.iml
 create mode 100644 .idea/modules.xml
 create mode 100644 .idea/vcs.xml

diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/client.iml b/.idea/client.iml
new file mode 100644
index 0000000..24643cc
--- /dev/null
+++ b/.idea/client.iml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..0742ebc
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/client.iml" filepath="$PROJECT_DIR$/.idea/client.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/src/components/recruit/vote.js b/src/components/recruit/vote.js
index 1d0c8fb..c6c6937 100644
--- a/src/components/recruit/vote.js
+++ b/src/components/recruit/vote.js
@@ -87,6 +87,7 @@ function Vote({ isOpen, onClose, data }) {
             if (response.ok){
                 alert("투표되었습니다.");
                 setCount((prev) => (prev + 1));
+                setAddSchedule([]);
             }else{
                 alert("투표를 실패하였습니다.");
             }
@@ -98,18 +99,18 @@ function Vote({ isOpen, onClose, data }) {
     const endVote = async ()=>{
         try{
             const response = await fetch(`/api/recruits/${data.id}/times/vote`,{
-                method: 'POST',
+                method: 'PUT',
                 headers: {
                     'Content-Type': 'application/json',
                 },
                 body: JSON.stringify({"idList" : addSchedule}),
             });
-
+            const jsonData = await response.json();
             if (response.ok){
                 alert("투표 마감 후 스케줄이 성공적으로 추가되었습니다.");
                 window.location.reload();
             }else{
-                alert('스케줄이 중복된 모집원이 존재합니다.');
+                alert('스케줄이 중복된 모집원이 존재합니다.\n'+jsonData);
             }
         } catch(error){
             console.log('Error during fetch:', error);
-- 
GitLab