Commit 5e8130f8 authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

0127

parent c4a0efaf
[{"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":10676,"mtime":1611721108415,"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]"] [{"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":1611725081816,"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":3725,"mtime":1611729247206,"results":"21","hashOfConfig":"14"},{"size":438,"mtime":1611699613873,"results":"22","hashOfConfig":"14"},{"size":5395,"mtime":1611732536752,"results":"23","hashOfConfig":"14"},{"size":11044,"mtime":1611732579543,"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},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"46","messages":"47","errorCount":0,"warningCount":12,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"48","messages":"49","errorCount":0,"warningCount":13,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\index.js",[],["52","53"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Components\\Place.js",["54"],"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",["55","56","57","58","59","60","61","62","63","64","65","66"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["67","68","69","70","71","72","73","74","75","76","77","78","79"],"C:\\Users\\hello\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js",[],{"ruleId":"80","replacedBy":"81"},{"ruleId":"82","replacedBy":"83"},{"ruleId":"84","severity":1,"message":"85","line":23,"column":6,"nodeType":"86","endLine":23,"endColumn":8,"suggestions":"87"},{"ruleId":"88","severity":1,"message":"89","line":2,"column":10,"nodeType":"90","messageId":"91","endLine":2,"endColumn":15},{"ruleId":"88","severity":1,"message":"92","line":2,"column":39,"nodeType":"90","messageId":"91","endLine":2,"endColumn":43},{"ruleId":"88","severity":1,"message":"93","line":7,"column":8,"nodeType":"90","messageId":"91","endLine":7,"endColumn":13},{"ruleId":"88","severity":1,"message":"94","line":16,"column":12,"nodeType":"90","messageId":"91","endLine":16,"endColumn":16},{"ruleId":"88","severity":1,"message":"95","line":16,"column":18,"nodeType":"90","messageId":"91","endLine":16,"endColumn":25},{"ruleId":"88","severity":1,"message":"96","line":17,"column":12,"nodeType":"90","messageId":"91","endLine":17,"endColumn":17},{"ruleId":"88","severity":1,"message":"97","line":17,"column":19,"nodeType":"90","messageId":"91","endLine":17,"endColumn":27},{"ruleId":"88","severity":1,"message":"98","line":18,"column":12,"nodeType":"90","messageId":"91","endLine":18,"endColumn":17},{"ruleId":"88","severity":1,"message":"99","line":19,"column":12,"nodeType":"90","messageId":"91","endLine":19,"endColumn":17},{"ruleId":"88","severity":1,"message":"100","line":19,"column":19,"nodeType":"90","messageId":"91","endLine":19,"endColumn":27},{"ruleId":"88","severity":1,"message":"101","line":22,"column":12,"nodeType":"90","messageId":"91","endLine":22,"endColumn":19},{"ruleId":"84","severity":1,"message":"102","line":64,"column":8,"nodeType":"86","endLine":64,"endColumn":10,"suggestions":"103"},{"ruleId":"88","severity":1,"message":"104","line":2,"column":16,"nodeType":"90","messageId":"91","endLine":2,"endColumn":24},{"ruleId":"88","severity":1,"message":"105","line":5,"column":83,"nodeType":"90","messageId":"91","endLine":5,"endColumn":86},{"ruleId":"88","severity":1,"message":"106","line":21,"column":12,"nodeType":"90","messageId":"91","endLine":21,"endColumn":18},{"ruleId":"88","severity":1,"message":"107","line":21,"column":20,"nodeType":"90","messageId":"91","endLine":21,"endColumn":29},{"ruleId":"88","severity":1,"message":"98","line":25,"column":12,"nodeType":"90","messageId":"91","endLine":25,"endColumn":17},{"ruleId":"88","severity":1,"message":"108","line":27,"column":20,"nodeType":"90","messageId":"91","endLine":27,"endColumn":31},{"ruleId":"88","severity":1,"message":"109","line":29,"column":19,"nodeType":"90","messageId":"91","endLine":29,"endColumn":27},{"ruleId":"84","severity":1,"message":"110","line":51,"column":8,"nodeType":"86","endLine":51,"endColumn":10,"suggestions":"111"},{"ruleId":"84","severity":1,"message":"112","line":64,"column":8,"nodeType":"86","endLine":64,"endColumn":28,"suggestions":"113"},{"ruleId":"84","severity":1,"message":"114","line":79,"column":8,"nodeType":"86","endLine":79,"endColumn":15,"suggestions":"115"},{"ruleId":"88","severity":1,"message":"116","line":94,"column":11,"nodeType":"90","messageId":"91","endLine":94,"endColumn":17},{"ruleId":"88","severity":1,"message":"117","line":184,"column":9,"nodeType":"90","messageId":"91","endLine":184,"endColumn":13},{"ruleId":"118","severity":1,"message":"119","line":189,"column":35,"nodeType":"120","endLine":189,"endColumn":76},"no-native-reassign",["121"],"no-negated-in-lhs",["122"],"react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.","ArrayExpression",["123"],"no-unused-vars","'Alert' is defined but never used.","Identifier","unusedVar","'Form' is defined but never used.","'Place' is defined but never used.","'page' is assigned a value but never used.","'setPage' is assigned a value but never used.","'index' is assigned a value but never used.","'setIndex' is assigned a value but never used.","'error' is assigned a value but never used.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'showSet' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.",["124"],"'Redirect' is defined but never used.","'Nav' is defined but never used.","'mobile' is assigned a value but never used.","'setMobile' is assigned a value but never used.","'getBookmark' is defined but never used.","'response' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.",["125"],"React Hook useEffect has missing dependencies: 'endPage' and 'pagePlace'. Either include them or remove the dependency array.",["126"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["127"],"'places' is assigned a value but never used.","'time' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","no-global-assign","no-unsafe-negation",{"desc":"128","fix":"129"},{"desc":"130","fix":"131"},{"desc":"132","fix":"133"},{"desc":"134","fix":"135"},{"desc":"136","fix":"137"},"Update the dependencies array to be: [getReview]",{"range":"138","text":"139"},"Update the dependencies array to be: [getBookmark]",{"range":"140","text":"141"},"Update the dependencies array to be: [getAssociation]",{"range":"142","text":"143"},"Update the dependencies array to be: [association, endPage, index, pagePlace]",{"range":"144","text":"145"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"146","text":"147"},[665,667],"[getReview]",[2225,2227],"[getBookmark]",[2018,2020],"[getAssociation]",[2418,2438],"[association, endPage, index, pagePlace]",[3017,3024],"[getAssociation, props.history, search, state]"]
\ No newline at end of file \ No newline at end of file
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar, ListGroup, Image, Table } from "react-bootstrap" import { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar } from "react-bootstrap"
import axios from "axios" import axios from "axios"
import catchErrors from './utils/catchErrors.js' import catchErrors from './utils/catchErrors.js'
import { isAuthenticated } from './utils/auth' import { isAuthenticated } from './utils/auth'
import * as Icon from 'react-bootstrap-icons';
import Place from './Components/Place.js'
const INIT_PAGE = { const INIT_PAGE = {
bookmark: ['성산일출봉', '제주도', '한라산', '주상절리', '오설록 티 뮤지엄',] bookmark: []
} }
function Bookmark() { function Bookmark() {
const [page, setPage] = useState(INIT_PAGE) const [page, setPage] = useState(INIT_PAGE)
const [index, setIndex] = useState(1);
const [error, setError] = useState('') const [error, setError] = useState('')
const [success, setSuccess] = useState(false)
const [state, setState] = useState(false); const [state, setState] = useState(false);
const [bookmark, setBookmark] = useState([false, false, false, false])
const [pagePlace, setPagePlace] = useState([])
const [showSet, setShowSet] = useState([false, false, false, false]);
const user = isAuthenticated() const user = isAuthenticated()
const userId = localStorage.getItem('loginStatus')
async function getBookmark() { async function getBookmark() {
try { try {
setError('') const response = await axios.get(`/api/users/bookmark?ID=${user}`)
console.log(page.bookmark) setPagePlace(response.data.bookmark)
const bookmark = page.bookmark
console.log(userId)
const response = await axios.put(`/api/users/bookmark`, { bookmark: bookmark, userId: userId })
console.log(response.data)
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError)
} }
} }
async function handleBookmark(index) {
if (!bookmark[index]) {
console.log(pagePlace[index])
try {
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
alert(response.data, '북마크가 저장되었습니다.')
const showArr = bookmark
showArr[index] = true
setBookmark(showArr)
console.log("bookmark=", bookmark)
} catch (error) {
catchErrors(error, setError)
}
} else {
try {
const response = await axios.delete(`/api/users/bookmark?ID=${user}`)
alert(response.data, '저장된 북마크가 삭제되었습니다.')
const showArr = bookmark
showArr[index] = false
setBookmark(showArr)
console.log("bookmark=", bookmark)
} catch (error) {
catchErrors(error, setError)
}
}
}
useEffect(() => {
getBookmark()
}, [])
return ( return (
<Container> <Container>
<Navbar style={"#"} bg="primary" variant="dark"> <Navbar bg="info" variant="dark">
<Navbar.Brand href="/">북마크</Navbar.Brand> <Navbar.Brand href="/">북마크</Navbar.Brand>
<Nav className="mr-auto"> <Nav className="mr-auto">
<Nav.Link href="/">Home</Nav.Link> <Nav.Link href="/">Home</Nav.Link>
</Nav> </Nav>
<Button type='submit' onClick={getBookmark}>저장</Button>
</Navbar> </Navbar>
<Form> <Row className="d-flex flex-wrap">
<ListGroup> {console.log("#####################33", pagePlace)}
<ListGroup.Item>{page.bookmark[0]}</ListGroup.Item> {pagePlace.map((place, index) => {
<ListGroup.Item>{page.bookmark[1]}</ListGroup.Item> return (
<ListGroup.Item>{page.bookmark[2]}</ListGroup.Item> <Col key={index} md={6} >
<ListGroup.Item>{page.bookmark[3]}</ListGroup.Item> <Card align="center" border="info" style={{ margin: "3%" }}>
<ListGroup.Item>{page.bookmark[4]}</ListGroup.Item>
</ListGroup> <Card.Title className="d-flex justify-content-center" style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place.name}
</Form> {user ?
<Button
variant={bookmark[index] ? "primary" : "light"}
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.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{place.address} </Card.Text>
<Button variant="info" onClick={() => {
const showArr = [false, false, false, false]
showArr[index] = true
setShowSet(showArr)
}}>{place.name} 자세히 살펴보기</Button>
{/* <Place place={place} index={index} show={showSet[index]} onHide={() => setShowSet([false, false, false, false])} /> */}
</Card.Body>
</Card>
</Col>
)
})}
</Row>
</Container> </Container>
) )
} }
...@@ -60,7 +114,7 @@ export default Bookmark ...@@ -60,7 +114,7 @@ export default Bookmark
// async function handleSubmit(e){ // async function handleSubmit(e){
// setState(true); //버튼이 눌려서 handlesubmit이될때 setState값이 true로 바뀐다 // setState(true); //버튼이 눌려서 handlesubmit이될때 setState값이 true로 바뀐다
// try { //respons 서버에 post로 요청하여 데이터를 받아온다 // try { //respons 서버에 post로 요청하여 데이터를 받아온다
// const response = await axios.post('/api/users/bookmark', page) // const response = await axios.post('/api/users/bookmark', page)
// setSuccess(true) // setSuccess(true)
......
...@@ -8,7 +8,7 @@ function Paginations(props) { ...@@ -8,7 +8,7 @@ function Paginations(props) {
return ( return (
<> <>
{(props.endPage > 5) ? {(props.endPage > 5) ?
<Pagination> <Pagination >
<Pagination.First onClick={() => props.handlePage(1)} /> <Pagination.First onClick={() => props.handlePage(1)} />
{props.index === 1 ? <Pagination.Prev onClick={() => props.handlePage(props.index)} /> : <Pagination.Prev onClick={() => props.handlePage(props.index - 1)} />} {props.index === 1 ? <Pagination.Prev onClick={() => props.handlePage(props.index)} /> : <Pagination.Prev onClick={() => props.handlePage(props.index - 1)} />}
{props.index === props.endPage - 1 ? <Pagination.Item onClick={() => props.handlePage(props.index - 3)}>{props.index - 3}</Pagination.Item> : ""} {props.index === props.endPage - 1 ? <Pagination.Item onClick={() => props.handlePage(props.index - 3)}>{props.index - 3}</Pagination.Item> : ""}
......
...@@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG'; import ohuh from '../ohuh-sm.PNG';
import Place from '../Components/Place'; import Place from '../Components/Place';
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button } from 'react-bootstrap'; import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button, Nav } from 'react-bootstrap';
import Paginations from '../Components/Paginations'; 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'; import { isAuthenticated } from '../utils/auth';
import catchErrors from '../utils/catchErrors'
function Search(props) { function Search(props) {
...@@ -21,8 +22,16 @@ function Search(props) { ...@@ -21,8 +22,16 @@ function Search(props) {
const [association, setAssociation] = useState([{ name: " ", address: " ", img: " " }]) const [association, setAssociation] = useState([{ name: " ", address: " ", img: " " }])
const [pagePlace, setPagePlace] = useState([{ name: " ", address: " ", img: " " }, { name: " ", address: " ", img: " " }]) const [pagePlace, setPagePlace] = useState([{ name: " ", address: " ", img: " " }, { name: " ", address: " ", img: " " }])
const [endPage, setEndPage] = useState(1) const [endPage, setEndPage] = useState(1)
const [error, setError] = useState('')
async function getBookmark() {
try {
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
// setBookmark(response.data.bookmark)
} catch (error) {
catchErrors(error, setError)
}
}
const getAssociation = () => { const getAssociation = () => {
axios.get(`/api/search/association?keyword=${search}`) axios.get(`/api/search/association?keyword=${search}`)
...@@ -147,19 +156,27 @@ function Search(props) { ...@@ -147,19 +156,27 @@ function Search(props) {
async function handlebookmark(index) { async function handlebookmark(index) {
if (!bookmark[index]) { if (!bookmark[index]) {
console.log(pagePlace[index]) console.log(pagePlace[index])
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`) try {
alert(response.data, '북마크가 저장되었습니다.') const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
const showArr = bookmark alert(response.data, '북마크가 저장되었습니다.')
showArr[index] = true const showArr = bookmark
setBookmark(showArr) showArr[index] = true
console.log("bookmark=", bookmark) setBookmark(showArr)
console.log("bookmark=", bookmark)
} catch (error) {
catchErrors(error, setError)
}
} else { } else {
const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`) try {
alert(response.data, '저장된 북마크가 삭제되었습니다.') const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
const showArr = bookmark alert(response.data, '저장된 북마크가 삭제되었습니다.')
showArr[index] = false const showArr = bookmark
setBookmark(showArr) showArr[index] = false
console.log("bookmark=", bookmark) setBookmark(showArr)
console.log("bookmark=", bookmark)
} catch (error) {
catchErrors(error, setError)
}
} }
} }
...@@ -197,9 +214,7 @@ function Search(props) { ...@@ -197,9 +214,7 @@ function Search(props) {
<Card.Title className="d-flex justify-content-center" style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place.name} <Card.Title className="d-flex justify-content-center" style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place.name}
{user ? {user ?
<Button <Button
variant={bookmark[index] ? "primary" : "light"} variant={bookmark[index] ? "primary" : "light"}
style={{}}
onClick={() => handlebookmark(index, place)}> onClick={() => handlebookmark(index, place)}>
<Icon.BookmarkStarFill size={35} /> <Icon.BookmarkStarFill size={35} />
{console.log("bookmark", bookmark)} {console.log("bookmark", bookmark)}
...@@ -209,7 +224,7 @@ function Search(props) { ...@@ -209,7 +224,7 @@ function Search(props) {
<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" }} >
{place.address} </Card.Text> {place.address} </Card.Text>
<Button variant="primary" onClick={() => { <Button variant="info" onClick={() => {
const showArr = [false, false, false, false] const showArr = [false, false, false, false]
showArr[index] = true showArr[index] = true
setShowSet(showArr) setShowSet(showArr)
......
...@@ -56,18 +56,19 @@ const search = async (req, res, next) => { ...@@ -56,18 +56,19 @@ const search = async (req, res, next) => {
const find = (req, res, next) => { const find = (req, res, next) => {
console.log("7", req.query.keyword) console.log("7", req.query.keyword)
const keyword = req.query.keyword const keyword = req.query.keyword
if (req.body.db) { res.send("dkssud")
next() // if (req.body.db) {
} // next()
Review.find({ keyword: keyword }, function (err, reviews) { // }
req.reviews = [] // Review.find({ keyword: keyword }, function (err, reviews) {
if (reviews) { // req.reviews = []
if (reviews.length > 10) { // if (reviews) {
res.status(200).send({ review: reviews, db: true }) // if (reviews.length > 10) {
} // res.status(200).send({ review: reviews, db: true })
req.reviews = reviews // }
} // req.reviews = reviews
next() // }
}) // next()
// })
} }
export default { search, find } export default { search, find }
...@@ -47,30 +47,13 @@ const userById = async (req, res, next, id) => { ...@@ -47,30 +47,13 @@ const userById = async (req, res, next, id) => {
} }
const getBookmark = async (req, res) => { const getBookmark = async (req, res) => {
const { bookmark, userId } = req.body await User.findOne({ _id: req.query.ID }).populate('bookmark').exec((err, bookmark) => {
console.log(bookmark, userId) console.log(bookmark, "dkssud")
// const bookpage = req.body.bookmark res.send(bookmark)
console.log('page:', bookmark) })
// const user = req.user.userId
console.log('userId:', userId)
const updatedUser = await User.findOne({ _id: userId })
if (updatedUser) {
updatedUser.bookmark = bookmark
updatedUser.save()
}
// const updatedUser = await new User({ bookmark }).save()
// res.json(updatedUser)
console.log(updatedUser)
res.send(updatedUser)
} }
const setBookmark = async (req, res) => { const setBookmark = async (req, res) => {
// const place = await Place.findOne(address)
// const bookmarkUser = await User.findOne({ place }.populate(bookmark))
// if (bookmarkUser) {
// bookmarkUser.save()
// }
console.log(req.query.ID, req.query.place, "여기에요 여기!!!!") console.log(req.query.ID, req.query.place, "여기에요 여기!!!!")
await User.updateOne({ _id: req.query.ID }, { $push: { bookmark: req.query.place } }) await User.updateOne({ _id: req.query.ID }, { $push: { bookmark: req.query.place } })
res.send("추가완료") res.send("추가완료")
......
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