Commit 393c3e38 authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

.

parent 6dc328f1
[{"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\index.js":"1","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Place.js":"3","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Login.js":"4","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\catchErrors.js":"5","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Signup.js":"6","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\auth.js":"7","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js":"8","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\App.js":"9","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js":"10","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Bookmark.js":"11","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js":"12"},{"size":1273,"mtime":1611560060506,"results":"13","hashOfConfig":"14"},{"size":362,"mtime":499162500000,"results":"15","hashOfConfig":"14"},{"size":1650,"mtime":1611552739016,"results":"16","hashOfConfig":"14"},{"size":3147,"mtime":1611553267391,"results":"17","hashOfConfig":"14"},{"size":405,"mtime":1609915408569,"results":"18","hashOfConfig":"14"},{"size":2959,"mtime":1611699671429,"results":"19","hashOfConfig":"14"},{"size":723,"mtime":1611670762295,"results":"20","hashOfConfig":"14"},{"size":2199,"mtime":1610503781980,"results":"21","hashOfConfig":"14"},{"size":2129,"mtime":1611699902042,"results":"22","hashOfConfig":"14"},{"size":438,"mtime":1611699613873,"results":"23","hashOfConfig":"14"},{"size":2646,"mtime":1611699941894,"results":"24","hashOfConfig":"14"},{"size":9095,"mtime":1611699762674,"results":"25","hashOfConfig":"14"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"28","usedDeprecatedRules":"29"},"1t9w6go",{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"29"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"34","usedDeprecatedRules":"29"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"29"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"29"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"29"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"29"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"47","messages":"48","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"49","messages":"50","errorCount":0,"warningCount":15,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"51","messages":"52","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\index.js",["53"],"import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport './index.css';\r\nimport 'bootstrap/dist/css/bootstrap.min.css';\r\nimport App from './App'\r\nimport Search from './Pages/Search';\r\nimport reportWebVitals from './reportWebVitals';\r\nimport Signup from './Components/Signup'\r\nimport Login from './Components/Login'\r\nimport PrivateRoute from \"./Components/PrivateRoute\";\r\nimport axios from 'axios'\r\nimport Bookmark from \"./Bookmark\"\r\nimport {\r\n BrowserRouter as Router,\r\n Switch,\r\n Route,\r\n Redirect,\r\n} from \"react-router-dom\";\r\n\r\nReactDOM.render(\r\n <React.StrictMode>\r\n <Router>\r\n <Switch>\r\n <Route exact path=\"/\" component={App} />\r\n <Route path=\"/search\" component={Search} />\r\n <Route path='/signup' component={Signup}/>\r\n <Route path='/login' component={Login} />\r\n <PrivateRoute path='/bookmark'><Bookmark/></PrivateRoute>\r\n <Redirect path=\"/search\" to=\"/search\" />\r\n </Switch>\r\n </Router>\r\n </React.StrictMode>,\r\n document.getElementById('root')\r\n);\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\nreportWebVitals();\r\n",["54","55"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Place.js",["56","57"],"import axios from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Modal, Container, Row, Button, } from 'react-bootstrap';\r\n\r\nfunction Place(props) {\r\n const [reviews, setReviews] = useState()\r\n const [db, setDb] = useState(false)\r\n const getReview = () => {\r\n axios({ url: `/api/review?keyword=${props.place.name}`, method: 'post', data: { db: db } })\r\n .then(res => {\r\n console.log(\"place res.data\", res.data)\r\n setReviews(res.data)\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n getReview();\r\n }, [])\r\n\r\n return (\r\n <Modal {...props}\r\n size=\"xl\"\r\n keyboard=\"true\"\r\n variant=\"backdrop.in\"\r\n aria-labelledby=\"example-modal-sizes-title-lg\">\r\n <Modal.Header closeButton>\r\n <Modal.Title id=\"contained-modal-title-vcenter\" style={{ fontSize: '40px' }}>\r\n {props.index + 1}. {props.place.name}\r\n </Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body className=\"show-grid\">\r\n <Container style={{ fontSize: '40px' }}>\r\n {Array.isArray(reviews) ? reviews.map((review, index) => {\r\n return (\r\n <Row className=\"mt-4\">\r\n <a href={review.link}>{review.title}</a>\r\n <div>{review.summary}</div>\r\n <div>{review.content}</div>\r\n </Row>\r\n )\r\n })\r\n : \"리뷰가 없습니다.\"}\r\n </Container>\r\n\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button block onClick={props.onHide}>Close</Button>\r\n </Modal.Footer>\r\n </Modal>\r\n );\r\n}\r\n\r\nexport default Place;\r\n","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Login.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\catchErrors.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Signup.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\auth.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\App.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Bookmark.js",["58","59","60","61","62","63","64","65","66","67","68","69","70","71","72"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["73","74","75","76","77","78","79"],{"ruleId":"80","severity":1,"message":"81","line":11,"column":8,"nodeType":"82","messageId":"83","endLine":11,"endColumn":13},{"ruleId":"84","replacedBy":"85"},{"ruleId":"86","replacedBy":"87"},{"ruleId":"80","severity":1,"message":"88","line":7,"column":14,"nodeType":"82","messageId":"83","endLine":7,"endColumn":19},{"ruleId":"89","severity":1,"message":"90","line":21,"column":6,"nodeType":"91","endLine":21,"endColumn":8,"suggestions":"92"},{"ruleId":"80","severity":1,"message":"93","line":1,"column":27,"nodeType":"82","messageId":"83","endLine":1,"endColumn":36},{"ruleId":"80","severity":1,"message":"94","line":2,"column":10,"nodeType":"82","messageId":"83","endLine":2,"endColumn":15},{"ruleId":"80","severity":1,"message":"95","line":2,"column":17,"nodeType":"82","messageId":"83","endLine":2,"endColumn":20},{"ruleId":"80","severity":1,"message":"96","line":2,"column":22,"nodeType":"82","messageId":"83","endLine":2,"endColumn":26},{"ruleId":"80","severity":1,"message":"97","line":2,"column":45,"nodeType":"82","messageId":"83","endLine":2,"endColumn":48},{"ruleId":"80","severity":1,"message":"98","line":2,"column":82,"nodeType":"82","messageId":"83","endLine":2,"endColumn":87},{"ruleId":"80","severity":1,"message":"99","line":2,"column":89,"nodeType":"82","messageId":"83","endLine":2,"endColumn":94},{"ruleId":"80","severity":1,"message":"100","line":15,"column":18,"nodeType":"82","messageId":"83","endLine":15,"endColumn":25},{"ruleId":"80","severity":1,"message":"101","line":16,"column":12,"nodeType":"82","messageId":"83","endLine":16,"endColumn":17},{"ruleId":"80","severity":1,"message":"102","line":17,"column":12,"nodeType":"82","messageId":"83","endLine":17,"endColumn":19},{"ruleId":"80","severity":1,"message":"103","line":17,"column":21,"nodeType":"82","messageId":"83","endLine":17,"endColumn":31},{"ruleId":"80","severity":1,"message":"104","line":18,"column":12,"nodeType":"82","messageId":"83","endLine":18,"endColumn":17},{"ruleId":"80","severity":1,"message":"105","line":18,"column":19,"nodeType":"82","messageId":"83","endLine":18,"endColumn":27},{"ruleId":"80","severity":1,"message":"106","line":20,"column":11,"nodeType":"82","messageId":"83","endLine":20,"endColumn":15},{"ruleId":"107","severity":1,"message":"108","line":39,"column":21,"nodeType":"109","endLine":39,"endColumn":32},{"ruleId":"80","severity":1,"message":"110","line":2,"column":16,"nodeType":"82","messageId":"83","endLine":2,"endColumn":24},{"ruleId":"80","severity":1,"message":"111","line":17,"column":12,"nodeType":"82","messageId":"83","endLine":17,"endColumn":18},{"ruleId":"89","severity":1,"message":"112","line":68,"column":8,"nodeType":"91","endLine":68,"endColumn":10,"suggestions":"113"},{"ruleId":"89","severity":1,"message":"114","line":72,"column":8,"nodeType":"91","endLine":72,"endColumn":21,"suggestions":"115"},{"ruleId":"89","severity":1,"message":"116","line":82,"column":8,"nodeType":"91","endLine":82,"endColumn":15,"suggestions":"117"},{"ruleId":"80","severity":1,"message":"118","line":85,"column":11,"nodeType":"82","messageId":"83","endLine":85,"endColumn":17},{"ruleId":"119","severity":1,"message":"120","line":163,"column":35,"nodeType":"109","endLine":163,"endColumn":76},"no-unused-vars","'axios' is defined but never used.","Identifier","unusedVar","no-native-reassign",["121"],"no-negated-in-lhs",["122"],"'setDb' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.","ArrayExpression",["123"],"'useEffect' is defined but never used.","'Alert' is defined but never used.","'Col' is defined but never used.","'Card' is defined but never used.","'Row' is defined but never used.","'Image' is defined but never used.","'Table' is defined but never used.","'setPage' is assigned a value but never used.","'error' is assigned a value but never used.","'success' is assigned a value but never used.","'setSuccess' is assigned a value but never used.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'user' is assigned a value but never used.","react/style-prop-object","Style prop value must be an object","JSXAttribute","'Redirect' is defined but never used.","'mobile' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.",["124"],"React Hook useEffect has a missing dependency: 'index'. Either include it or remove the dependency array. You can also replace multiple useState variables with useReducer if 'setPagePlace' needs the current value of 'index'.",["125"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["126"],"'places' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","no-global-assign","no-unsafe-negation",{"desc":"127","fix":"128"},{"desc":"129","fix":"130"},{"desc":"131","fix":"132"},{"desc":"133","fix":"134"},"Update the dependencies array to be: [getReview]",{"range":"135","text":"136"},"Update the dependencies array to be: [getAssociation]",{"range":"137","text":"138"},"Update the dependencies array to be: [association, index]",{"range":"139","text":"140"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"141","text":"142"},[605,607],"[getReview]",[2337,2339],"[getAssociation]",[2447,2460],"[association, index]",[2690,2697],"[getAssociation, props.history, search, state]"] [{"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\index.js":"1","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Place.js":"3","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Login.js":"4","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\catchErrors.js":"5","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Signup.js":"6","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\auth.js":"7","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js":"8","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js":"9","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Bookmark.js":"10","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js":"11","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js":"12"},{"size":1252,"mtime":1611703918328,"results":"13","hashOfConfig":"14"},{"size":362,"mtime":499162500000,"results":"15","hashOfConfig":"14"},{"size":1710,"mtime":1611706811157,"results":"16","hashOfConfig":"14"},{"size":3147,"mtime":1611553267391,"results":"17","hashOfConfig":"14"},{"size":405,"mtime":1609915408569,"results":"18","hashOfConfig":"14"},{"size":2959,"mtime":1611699671429,"results":"19","hashOfConfig":"14"},{"size":723,"mtime":1611670762295,"results":"20","hashOfConfig":"14"},{"size":2199,"mtime":1610503781980,"results":"21","hashOfConfig":"14"},{"size":438,"mtime":1611699613873,"results":"22","hashOfConfig":"14"},{"size":2646,"mtime":1611699941894,"results":"23","hashOfConfig":"14"},{"size":10666,"mtime":1611716285334,"results":"24","hashOfConfig":"14"},{"size":2131,"mtime":1611702813920,"results":"25","hashOfConfig":"14"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},"1t9w6go",{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33","usedDeprecatedRules":"28"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"46","messages":"47","errorCount":0,"warningCount":15,"fixableErrorCount":0,"fixableWarningCount":0,"source":"48","usedDeprecatedRules":"28"},{"filePath":"49","messages":"50","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"51","messages":"52","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\index.js",[],["53","54"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Place.js",["55"],"import axios from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Modal, Container, Row, Button, } from 'react-bootstrap';\r\n\r\nfunction Place(props) {\r\n const [reviews, setReviews] = useState()\r\n const [db, setDb] = useState(false)\r\n const getReview = () => {\r\n axios({ url: `/api/review?keyword=${props.place.name}`, method: 'post', data: { db: db } })\r\n .then(res => {\r\n console.log(\"place res.data\", res.data)\r\n setReviews(res.data.review)\r\n setDb(res.data.db)\r\n console.log(db)\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n getReview();\r\n }, [])\r\n\r\n return (\r\n <Modal {...props}\r\n size=\"xl\"\r\n keyboard=\"true\"\r\n variant=\"backdrop.in\"\r\n aria-labelledby=\"example-modal-sizes-title-lg\">\r\n <Modal.Header closeButton>\r\n <Modal.Title id=\"contained-modal-title-vcenter\" style={{ fontSize: '40px' }}>\r\n {props.index + 1}. {props.place.name}\r\n </Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body className=\"show-grid\">\r\n <Container style={{ fontSize: '40px' }}>\r\n {Array.isArray(reviews) ? reviews.map((review, index) => {\r\n return (\r\n <Row className=\"mt-4\">\r\n <a href={review.link}>{review.title}</a>\r\n <div>{review.summary}</div>\r\n <div>{review.content}</div>\r\n </Row>\r\n )\r\n })\r\n : \"리뷰가 없습니다.\"}\r\n </Container>\r\n\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button block onClick={props.onHide}>Close</Button>\r\n </Modal.Footer>\r\n </Modal>\r\n );\r\n}\r\n\r\nexport default Place;\r\n","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Login.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\catchErrors.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Signup.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\utils\\auth.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\PrivateRoute.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Bookmark.js",["56","57","58","59","60","61","62","63","64","65","66","67","68","69","70"],"import React, { useState, useEffect } from 'react'\r\nimport { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar, ListGroup, Image, Table } from \"react-bootstrap\"\r\nimport axios from \"axios\"\r\nimport catchErrors from './utils/catchErrors.js'\r\nimport { isAuthenticated } from './utils/auth'\r\n\r\n\r\nconst INIT_PAGE = {\r\n bookmark: ['성산일출봉', '제주도', '한라산', '주상절리', '오설록 티 뮤지엄',]\r\n\r\n}\r\n\r\n\r\nfunction Bookmark() {\r\n const [page, setPage] = useState(INIT_PAGE)\r\n const [error, setError] = useState('')\r\n const [success, setSuccess] = useState(false)\r\n const [state, setState] = useState(false);\r\n\r\n const user = isAuthenticated()\r\n\r\n const userId = localStorage.getItem('loginStatus')\r\n\r\n async function getBookmark() {\r\n try {\r\n setError('')\r\n console.log(page.bookmark)\r\n const bookmark = page.bookmark\r\n console.log(userId)\r\n const response = await axios.put(`/api/users/bookmark`, { bookmark: bookmark, userId: userId })\r\n console.log(response.data)\r\n } catch (error) {\r\n catchErrors(error, setError)\r\n }\r\n }\r\n\r\n return (\r\n <Container>\r\n <Navbar style={\"#\"} bg=\"primary\" variant=\"dark\">\r\n <Navbar.Brand href=\"/\">북마크</Navbar.Brand>\r\n <Nav className=\"mr-auto\">\r\n <Nav.Link href=\"/\">Home</Nav.Link>\r\n </Nav>\r\n <Button type='submit' onClick={getBookmark}>저장</Button>\r\n </Navbar>\r\n <Form>\r\n <ListGroup>\r\n <ListGroup.Item>{page.bookmark[0]}</ListGroup.Item>\r\n <ListGroup.Item>{page.bookmark[1]}</ListGroup.Item>\r\n <ListGroup.Item>{page.bookmark[2]}</ListGroup.Item>\r\n <ListGroup.Item>{page.bookmark[3]}</ListGroup.Item>\r\n <ListGroup.Item>{page.bookmark[4]}</ListGroup.Item>\r\n </ListGroup>\r\n </Form>\r\n </Container>\r\n )\r\n}\r\n\r\nexport default Bookmark\r\n\r\n\r\n // async function handleSubmit(e){\r\n // setState(true); //버튼이 눌려서 handlesubmit이될때 setState값이 true로 바뀐다\r\n // try { //respons 서버에 post로 요청하여 데이터를 받아온다\r\n // const response = await axios.post('/api/users/bookmark', page)\r\n // setSuccess(true)\r\n // } catch (error) {\r\n // console.log(error)\r\n // catchErrors(error, setError)\r\n // }\r\n // }\r\n\r\n // useEffect(() => {\r\n // getBookmark(user)\r\n // }, [user])","C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["71","72","73","74","75","76"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js",[],{"ruleId":"77","replacedBy":"78"},{"ruleId":"79","replacedBy":"80"},{"ruleId":"81","severity":1,"message":"82","line":23,"column":6,"nodeType":"83","endLine":23,"endColumn":8,"suggestions":"84"},{"ruleId":"85","severity":1,"message":"86","line":1,"column":27,"nodeType":"87","messageId":"88","endLine":1,"endColumn":36},{"ruleId":"85","severity":1,"message":"89","line":2,"column":10,"nodeType":"87","messageId":"88","endLine":2,"endColumn":15},{"ruleId":"85","severity":1,"message":"90","line":2,"column":17,"nodeType":"87","messageId":"88","endLine":2,"endColumn":20},{"ruleId":"85","severity":1,"message":"91","line":2,"column":22,"nodeType":"87","messageId":"88","endLine":2,"endColumn":26},{"ruleId":"85","severity":1,"message":"92","line":2,"column":45,"nodeType":"87","messageId":"88","endLine":2,"endColumn":48},{"ruleId":"85","severity":1,"message":"93","line":2,"column":82,"nodeType":"87","messageId":"88","endLine":2,"endColumn":87},{"ruleId":"85","severity":1,"message":"94","line":2,"column":89,"nodeType":"87","messageId":"88","endLine":2,"endColumn":94},{"ruleId":"85","severity":1,"message":"95","line":15,"column":18,"nodeType":"87","messageId":"88","endLine":15,"endColumn":25},{"ruleId":"85","severity":1,"message":"96","line":16,"column":12,"nodeType":"87","messageId":"88","endLine":16,"endColumn":17},{"ruleId":"85","severity":1,"message":"97","line":17,"column":12,"nodeType":"87","messageId":"88","endLine":17,"endColumn":19},{"ruleId":"85","severity":1,"message":"98","line":17,"column":21,"nodeType":"87","messageId":"88","endLine":17,"endColumn":31},{"ruleId":"85","severity":1,"message":"99","line":18,"column":12,"nodeType":"87","messageId":"88","endLine":18,"endColumn":17},{"ruleId":"85","severity":1,"message":"100","line":18,"column":19,"nodeType":"87","messageId":"88","endLine":18,"endColumn":27},{"ruleId":"85","severity":1,"message":"101","line":20,"column":11,"nodeType":"87","messageId":"88","endLine":20,"endColumn":15},{"ruleId":"102","severity":1,"message":"103","line":39,"column":21,"nodeType":"104","endLine":39,"endColumn":32},{"ruleId":"85","severity":1,"message":"105","line":2,"column":16,"nodeType":"87","messageId":"88","endLine":2,"endColumn":24},{"ruleId":"81","severity":1,"message":"106","line":62,"column":8,"nodeType":"83","endLine":62,"endColumn":10,"suggestions":"107"},{"ruleId":"81","severity":1,"message":"108","line":70,"column":8,"nodeType":"83","endLine":70,"endColumn":21,"suggestions":"109"},{"ruleId":"81","severity":1,"message":"110","line":85,"column":8,"nodeType":"83","endLine":85,"endColumn":15,"suggestions":"111"},{"ruleId":"85","severity":1,"message":"112","line":100,"column":11,"nodeType":"87","messageId":"88","endLine":100,"endColumn":17},{"ruleId":"113","severity":1,"message":"114","line":181,"column":35,"nodeType":"104","endLine":181,"endColumn":76},"no-native-reassign",["115"],"no-negated-in-lhs",["116"],"react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.","ArrayExpression",["117"],"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'Alert' is defined but never used.","'Col' is defined but never used.","'Card' is defined but never used.","'Row' is defined but never used.","'Image' is defined but never used.","'Table' is defined but never used.","'setPage' is assigned a value but never used.","'error' is assigned a value but never used.","'success' is assigned a value but never used.","'setSuccess' is assigned a value but never used.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'user' is assigned a value but never used.","react/style-prop-object","Style prop value must be an object","JSXAttribute","'Redirect' is defined but never used.","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.",["118"],"React Hook useEffect has a missing dependency: 'index'. Either include it or remove the dependency array. You can also replace multiple useState variables with useReducer if 'setPagePlace' needs the current value of 'index'.",["119"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["120"],"'places' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","no-global-assign","no-unsafe-negation",{"desc":"121","fix":"122"},{"desc":"123","fix":"124"},{"desc":"125","fix":"126"},{"desc":"127","fix":"128"},"Update the dependencies array to be: [getReview]",{"range":"129","text":"130"},"Update the dependencies array to be: [getAssociation]",{"range":"131","text":"132"},"Update the dependencies array to be: [association, index]",{"range":"133","text":"134"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"135","text":"136"},[665,667],"[getReview]",[2298,2300],"[getAssociation]",[2506,2519],"[association, index]",[3099,3106],"[getAssociation, props.history, search, state]"]
\ No newline at end of file \ No newline at end of file
...@@ -3949,143 +3949,6 @@ ...@@ -3949,143 +3949,6 @@
"resolved": "https://registry.npmjs.org/check-types/-/check-types-11.1.2.tgz", "resolved": "https://registry.npmjs.org/check-types/-/check-types-11.1.2.tgz",
"integrity": "sha512-tzWzvgePgLORb9/3a0YenggReLKAIb2owL03H2Xdoe5pKcUyWRSEQ8xfCar8t2SIAuEDwtmx2da1YB52YuHQMQ==" "integrity": "sha512-tzWzvgePgLORb9/3a0YenggReLKAIb2owL03H2Xdoe5pKcUyWRSEQ8xfCar8t2SIAuEDwtmx2da1YB52YuHQMQ=="
}, },
"cheerio": {
"version": "1.0.0-rc.5",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.5.tgz",
"integrity": "sha512-yoqps/VCaZgN4pfXtenwHROTp8NG6/Hlt4Jpz2FEP0ZJQ+ZUkVDd0hAPDNKhj3nakpfPt/CNs57yEtxD1bXQiw==",
"requires": {
"cheerio-select-tmp": "^0.1.0",
"dom-serializer": "~1.2.0",
"domhandler": "^4.0.0",
"entities": "~2.1.0",
"htmlparser2": "^6.0.0",
"parse5": "^6.0.0",
"parse5-htmlparser2-tree-adapter": "^6.0.0"
},
"dependencies": {
"dom-serializer": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz",
"integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==",
"requires": {
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0",
"entities": "^2.0.0"
}
},
"domelementtype": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz",
"integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w=="
},
"domhandler": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz",
"integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==",
"requires": {
"domelementtype": "^2.1.0"
}
},
"domutils": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.4.tgz",
"integrity": "sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA==",
"requires": {
"dom-serializer": "^1.0.1",
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0"
}
},
"htmlparser2": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.0.0.tgz",
"integrity": "sha512-numTQtDZMoh78zJpaNdJ9MXb2cv5G3jwUoe3dMQODubZvLoGvTE/Ofp6sHvH8OGKcN/8A47pGLi/k58xHP/Tfw==",
"requires": {
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0",
"domutils": "^2.4.4",
"entities": "^2.0.0"
}
},
"parse5": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
}
}
},
"cheerio-select-tmp": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/cheerio-select-tmp/-/cheerio-select-tmp-0.1.1.tgz",
"integrity": "sha512-YYs5JvbpU19VYJyj+F7oYrIE2BOll1/hRU7rEy/5+v9BzkSo3bK81iAeeQEMI92vRIxz677m72UmJUiVwwgjfQ==",
"requires": {
"css-select": "^3.1.2",
"css-what": "^4.0.0",
"domelementtype": "^2.1.0",
"domhandler": "^4.0.0",
"domutils": "^2.4.4"
},
"dependencies": {
"css-select": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-3.1.2.tgz",
"integrity": "sha512-qmss1EihSuBNWNNhHjxzxSfJoFBM/lERB/Q4EnsJQQC62R2evJDW481091oAdOr9uh46/0n4nrg0It5cAnj1RA==",
"requires": {
"boolbase": "^1.0.0",
"css-what": "^4.0.0",
"domhandler": "^4.0.0",
"domutils": "^2.4.3",
"nth-check": "^2.0.0"
}
},
"css-what": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-4.0.0.tgz",
"integrity": "sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A=="
},
"dom-serializer": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz",
"integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==",
"requires": {
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0",
"entities": "^2.0.0"
}
},
"domelementtype": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz",
"integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w=="
},
"domhandler": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz",
"integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==",
"requires": {
"domelementtype": "^2.1.0"
}
},
"domutils": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.4.tgz",
"integrity": "sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA==",
"requires": {
"dom-serializer": "^1.0.1",
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0"
}
},
"nth-check": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz",
"integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==",
"requires": {
"boolbase": "^1.0.0"
}
}
}
},
"chokidar": { "chokidar": {
"version": "3.4.3", "version": "3.4.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz",
...@@ -10914,21 +10777,6 @@ ...@@ -10914,21 +10777,6 @@
"resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
"integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==" "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="
}, },
"parse5-htmlparser2-tree-adapter": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
"integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",
"requires": {
"parse5": "^6.0.1"
},
"dependencies": {
"parse5": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
}
}
},
"parseurl": { "parseurl": {
"version": "1.3.3", "version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"@testing-library/user-event": "^12.6.0", "@testing-library/user-event": "^12.6.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
"cheerio": "^1.0.0-rc.5",
"react": "^17.0.1", "react": "^17.0.1",
"react-bootstrap": "^1.4.0", "react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
......
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import ohuh from './ohuh.PNG' import ohuh from '../ohuh.PNG'
import { Container, Row, Form, Image, InputGroup, Button, Col, Nav } from 'react-bootstrap'; import { Container, Row, Form, Image, InputGroup, Button, Col, Nav } from 'react-bootstrap';
import { handleLogout, isAuthenticated } from './utils/auth.js' import { handleLogout, isAuthenticated } from '../utils/auth.js'
function App() { function App() {
const [state, setState] = useState(false); const [state, setState] = useState(false);
......
...@@ -7,6 +7,7 @@ import Paginations from '../Components/Paginations'; ...@@ -7,6 +7,7 @@ import Paginations from '../Components/Paginations';
import axios from 'axios'; import axios from 'axios';
import queryString from 'query-string' import queryString from 'query-string'
import * as Icon from 'react-bootstrap-icons'; import * as Icon from 'react-bootstrap-icons';
import { isAuthenticated } from '../utils/auth';
function Search(props) { function Search(props) {
const endPage = 10; const endPage = 10;
...@@ -14,10 +15,11 @@ function Search(props) { ...@@ -14,10 +15,11 @@ function Search(props) {
const [index, setIndex] = useState(1); const [index, setIndex] = useState(1);
const [showSet, setShowSet] = useState([false, false, false, false]); const [showSet, setShowSet] = useState([false, false, false, false]);
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword); const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
const [pagePlace, setPagePlace] = useState(); // const [pagePlace, setPagePlace] = useState();
const [association, setAssociation] = useState([]) const [association, setAssociation] = useState([])
const [pagePlace, setPagePlace] = useState([]) const [pagePlace, setPagePlace] = useState([])
const [bookmark, setBookmark] = useState([false, false, false, false]) const [bookmark, setBookmark] = useState([false, false, false, false])
const user = isAuthenticated()
// console.log("search###############", search) // console.log("search###############", search)
// const getPlace = () => { // const getPlace = () => {
...@@ -59,6 +61,10 @@ function Search(props) { ...@@ -59,6 +61,10 @@ function Search(props) {
getAssociation() getAssociation()
}, []); }, []);
useEffect(() => {
console.log("222222222222222222", bookmark)
}, [bookmark])
useEffect(() => { useEffect(() => {
setPagePlace(paginate(association, index, association.length)) setPagePlace(paginate(association, index, association.length))
}, [association]); }, [association]);
...@@ -72,11 +78,11 @@ function Search(props) { ...@@ -72,11 +78,11 @@ function Search(props) {
// state: { id: search }, // state: { id: search },
// }} />; // }} />;
props.history.push('/search?keyword=' + search) props.history.push('/search?keyword=' + search)
// setState(false) setState(false)
// console.log("search야", search) // console.log("search야", search)
} window.addEventListener("scroll", infiniteScroll); } window.addEventListener("scroll", infiniteScroll);
return () => { window.removeEventListener("scroll", infiniteScroll); } return () => { window.removeEventListener("scroll", infiniteScroll); }
}, []); }, [state]);
const infiniteScroll = () => { const infiniteScroll = () => {
const { documentElement, body } = document; const { documentElement, body } = document;
...@@ -147,19 +153,22 @@ function Search(props) { ...@@ -147,19 +153,22 @@ function Search(props) {
return page return page
} }
async function handlebookmark(index, place) { async function handlebookmark(index) {
if (!bookmark[index]) { if (!bookmark[index]) {
// const response = await axios.put('/api/bookmark',) console.log(pagePlace[index])
alert('북마크가 저장되었습니다.') const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
alert(response.data, '북마크가 저장되었습니다.')
const showArr = bookmark const showArr = bookmark
showArr[index] = true showArr[index] = true
setBookmark(showArr) setBookmark(showArr)
console.log("bookmark=", bookmark)
} else { } else {
// axios.delete('') const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
alert('저장된 북마크가 삭제되었습니다.') alert(response.data, '저장된 북마크가 삭제되었습니다.')
const showArr = bookmark const showArr = bookmark
showArr[index] = false showArr[index] = false
setBookmark(showArr) setBookmark(showArr)
console.log("bookmark=", bookmark)
} }
} }
...@@ -191,12 +200,18 @@ function Search(props) { ...@@ -191,12 +200,18 @@ function Search(props) {
return ( return (
<Col key={index} md={6} > <Col key={index} md={6} >
<Card align="center" border="info" style={{ margin: "3%" }}> <Card align="center" border="info" style={{ margin: "3%" }}>
<Button
style={{ marginLeft: "50vh" }} <Card.Title className="d-flex justify-content-center" style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place.name}
onClick={() => handlebookmark(index, place)}> {user ?
{console.log(bookmark)} <Icon.BookmarkStarFill size={35} /> <Icon.BookmarkStar size={35} /> <Button
</Button>
<Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place.name}</Card.Title> variant={bookmark[index] ? "primary" : "light"}
style={{}}
onClick={() => handlebookmark(index, place)}>
<Icon.BookmarkStarFill size={35} />
{console.log("bookmark", bookmark)}
{console.log("bookmark[index]", bookmark[index])}</Button> : null}
</Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={place.img} /> <Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={place.img} />
<Card.Body > <Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} > <Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
...@@ -216,7 +231,7 @@ function Search(props) { ...@@ -216,7 +231,7 @@ function Search(props) {
<Row className="mt-2 d-flex justify-content-center"> <Row className="mt-2 d-flex justify-content-center">
<Paginations index={index} endPage={endPage} handlePage={handlePage}></Paginations> <Paginations index={index} endPage={endPage} handlePage={handlePage}></Paginations>
</Row> </Row>
</Container> </Container >
); );
} }
......
...@@ -2,13 +2,12 @@ import React from 'react'; ...@@ -2,13 +2,12 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import './index.css'; import './index.css';
import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/css/bootstrap.min.css';
import App from './App' import App from './Pages/App'
import Search from './Pages/Search'; import Search from './Pages/Search';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals';
import Signup from './Components/Signup' import Signup from './Components/Signup'
import Login from './Components/Login' import Login from './Components/Login'
import PrivateRoute from "./Components/PrivateRoute"; import PrivateRoute from "./Components/PrivateRoute";
import axios from 'axios'
import Bookmark from "./Bookmark" import Bookmark from "./Bookmark"
import { import {
BrowserRouter as Router, BrowserRouter as Router,
......
...@@ -64,8 +64,22 @@ const getBookmark = async (req, res) => { ...@@ -64,8 +64,22 @@ const getBookmark = async (req, res) => {
res.send(updatedUser) res.send(updatedUser)
} }
// function handlebookmark() { const setBookmark = async (req, res) => {
// const bookmarkUser = await User.findOne({}) // const place = await Place.findOne(address)
// } // const bookmarkUser = await User.findOne({ place }.populate(bookmark))
// if (bookmarkUser) {
export default { signup, userById, getBookmark } // bookmarkUser.save()
\ No newline at end of file // }
console.log(req.query.ID, req.query.place, "여기에요 여기!!!!")
await User.updateOne({ _id: req.query.ID }, { $push: { bookmark: req.query.place } })
res.send("추가완료")
}
const deleteBookmark = async (req, res) => {
console.log(req.query.ID, req.query.place)
await User.updateOne({ _id: req.query.ID }, { $pull: { bookmark: req.query.place } })
res.send("삭제완료")
}
export default { signup, userById, getBookmark, setBookmark, deleteBookmark }
\ No newline at end of file
...@@ -7,7 +7,9 @@ router.route('/api/users/signup') ...@@ -7,7 +7,9 @@ router.route('/api/users/signup')
.post(userCtrl.signup) .post(userCtrl.signup)
router.route('/api/users/bookmark') router.route('/api/users/bookmark')
.put(userCtrl.getBookmark) .get(userCtrl.getBookmark)
.put(userCtrl.setBookmark)
.delete(userCtrl.deleteBookmark)
router.param('userId', userCtrl.userById) router.param('userId', userCtrl.userById)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment