김대철

후기 작성 링크 파라미터 수정

map.ejs에서 comment.ejs로 카페고유 아이디값 넘겨주는 작업 진행
...@@ -159,13 +159,14 @@ router.get("/logout", function (req, res) { ...@@ -159,13 +159,14 @@ router.get("/logout", function (req, res) {
159 res.redirect("/"); 159 res.redirect("/");
160 }); 160 });
161 161
162 -router.get("/comment", function (req, res) { 162 +router.get("/comment/:cafeId", function (req, res) {
163 - res.render("comment"); 163 + const cafeId = req.params.cafeId;
164 + res.render("comment", { cafeId: cafeId });
164 }); 165 });
165 166
166 // 카페 후기 등록 167 // 카페 후기 등록
167 router.post("/comment", function (req, res) { 168 router.post("/comment", function (req, res) {
168 - var cafeId = req.query.cafeId; 169 + var cafeId = req.body.cafeId;
169 var price = req.body.price; 170 var price = req.body.price;
170 var kindness = req.body.kindness; 171 var kindness = req.body.kindness;
171 var noise = req.body.noise; 172 var noise = req.body.noise;
...@@ -179,7 +180,7 @@ router.post("/comment", function (req, res) { ...@@ -179,7 +180,7 @@ router.post("/comment", function (req, res) {
179 // 입력받지 않은 데이터가 하나라도 존재 (카페아이디는 후기작성시 자동으로 받아옴) 180 // 입력받지 않은 데이터가 하나라도 존재 (카페아이디는 후기작성시 자동으로 받아옴)
180 if (!cafeId || !price || !kindness || !noise || !accessibility) { 181 if (!cafeId || !price || !kindness || !noise || !accessibility) {
181 console.log("입력받지 않은 데이터 존재"); 182 console.log("입력받지 않은 데이터 존재");
182 - res.redirect("/comment"); // 후기작성으로 다시 이동 183 + res.redirect("/comment/:cafeId"); // 후기작성으로 다시 이동
183 } 184 }
184 185
185 var sql = 186 var sql =
......
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1622031757269}
...\ No newline at end of file ...\ No newline at end of file
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1622032034021}
...\ No newline at end of file ...\ No newline at end of file
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1622032180844}
...\ No newline at end of file ...\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 5
6 <title>Enroll Comment</title> 6 <title>Enroll Comment</title>
7 7
8 - <link rel="stylesheet" href="stylesheets/bootstrap.css"> 8 + <link rel="stylesheet" href="/stylesheets/bootstrap.css">
9 <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@700&display=swap" rel="stylesheet"> 9 <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@700&display=swap" rel="stylesheet">
10 10
11 <style> 11 <style>
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
32 <div class="col-2"></div> 32 <div class="col-2"></div>
33 <div class="col-8"> 33 <div class="col-8">
34 <hr class="my-4" style="background-color: white"> 34 <hr class="my-4" style="background-color: white">
35 - <form method="post"> 35 + <form action="/comment" method="post">
36 - <div class></div>
37 <hr class="my-3" style="background-color: white"> 36 <hr class="my-3" style="background-color: white">
38 <label for="price" class="form-label">가격</label> 37 <label for="price" class="form-label">가격</label>
39 <select class="form-select form-select-lg" id="price" name="price" required> 38 <select class="form-select form-select-lg" id="price" name="price" required>
...@@ -86,5 +85,4 @@ ...@@ -86,5 +85,4 @@
86 </div> 85 </div>
87 </section> 86 </section>
88 </body> 87 </body>
89 -<script src="javascripts/bootstrap.js"></script>
90 </html> 88 </html>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -227,6 +227,7 @@ ...@@ -227,6 +227,7 @@
227 return marker; 227 return marker;
228 } 228 }
229 function displayPlaceInfo(place) { 229 function displayPlaceInfo(place) {
230 + console.log(place);
230 var content = 231 var content =
231 '<div class="placeinfo">' + 232 '<div class="placeinfo">' +
232 ' <a class="title" href="' + 233 ' <a class="title" href="' +
...@@ -260,7 +261,7 @@ ...@@ -260,7 +261,7 @@
260 ' <span class="tel">' + 261 ' <span class="tel">' +
261 place.phone + 262 place.phone +
262 "</span>" + 263 "</span>" +
263 - '<a href="/comment"><button>후기 작성</button>'; 264 + `<a href="/comment/${place.id}"><button>후기 작성</button>`;
264 "</div>" + '<div class="after"></div>'; 265 "</div>" + '<div class="after"></div>';
265 contentNode.innerHTML = content; 266 contentNode.innerHTML = content;
266 placeOverlay.setPosition(new kakao.maps.LatLng(place.y, place.x)); 267 placeOverlay.setPosition(new kakao.maps.LatLng(place.y, place.x));
......