김대철

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

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