Commit 862b8127 authored by baesangjune's avatar baesangjune
Browse files

머지

parent f412cf25
[{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js":"3","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js":"5","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js":"6","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Bookmark.js":"7","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js":"8","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js":"9","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js":"10","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js":"11"},{"size":1339,"mtime":1612133560398,"results":"12","hashOfConfig":"13"},{"size":375,"mtime":1611254909401,"results":"14","hashOfConfig":"13"},{"size":3725,"mtime":1612133560393,"results":"15","hashOfConfig":"13"},{"size":8447,"mtime":1612152686729,"results":"16","hashOfConfig":"13"},{"size":4773,"mtime":1612146987427,"results":"17","hashOfConfig":"13"},{"size":438,"mtime":1612133560394,"results":"18","hashOfConfig":"13"},{"size":5312,"mtime":1612147636744,"results":"19","hashOfConfig":"13"},{"size":3150,"mtime":1612140232971,"results":"20","hashOfConfig":"13"},{"size":2959,"mtime":1612133560395,"results":"21","hashOfConfig":"13"},{"size":2355,"mtime":1612139729084,"results":"22","hashOfConfig":"13"},{"size":766,"mtime":1612140214129,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"13y9yvi",{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","errorCount":0,"warningCount":10,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"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":"26"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js",[],["47","48"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js",["49","50","51","52","53","54","55"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Bookmark.js",["56","57","58","59","60","61","62","63","64","65"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js",["66"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js",[],{"ruleId":"67","replacedBy":"68"},{"ruleId":"69","replacedBy":"70"},{"ruleId":"71","severity":1,"message":"72","line":4,"column":83,"nodeType":"73","messageId":"74","endLine":4,"endColumn":86},{"ruleId":"71","severity":1,"message":"75","line":22,"column":12,"nodeType":"73","messageId":"74","endLine":22,"endColumn":17},{"ruleId":"71","severity":1,"message":"76","line":24,"column":20,"nodeType":"73","messageId":"74","endLine":24,"endColumn":31},{"ruleId":"71","severity":1,"message":"77","line":26,"column":19,"nodeType":"73","messageId":"74","endLine":26,"endColumn":27},{"ruleId":"78","severity":1,"message":"79","line":48,"column":8,"nodeType":"80","endLine":48,"endColumn":10,"suggestions":"81"},{"ruleId":"78","severity":1,"message":"82","line":74,"column":8,"nodeType":"80","endLine":74,"endColumn":15,"suggestions":"83"},{"ruleId":"84","severity":1,"message":"85","line":146,"column":35,"nodeType":"86","endLine":146,"endColumn":76},{"ruleId":"71","severity":1,"message":"87","line":17,"column":12,"nodeType":"73","messageId":"74","endLine":17,"endColumn":16},{"ruleId":"71","severity":1,"message":"88","line":17,"column":18,"nodeType":"73","messageId":"74","endLine":17,"endColumn":25},{"ruleId":"71","severity":1,"message":"89","line":18,"column":12,"nodeType":"73","messageId":"74","endLine":18,"endColumn":17},{"ruleId":"71","severity":1,"message":"90","line":18,"column":19,"nodeType":"73","messageId":"74","endLine":18,"endColumn":27},{"ruleId":"71","severity":1,"message":"75","line":19,"column":12,"nodeType":"73","messageId":"74","endLine":19,"endColumn":17},{"ruleId":"71","severity":1,"message":"91","line":20,"column":12,"nodeType":"73","messageId":"74","endLine":20,"endColumn":17},{"ruleId":"71","severity":1,"message":"92","line":20,"column":19,"nodeType":"73","messageId":"74","endLine":20,"endColumn":27},{"ruleId":"71","severity":1,"message":"93","line":23,"column":12,"nodeType":"73","messageId":"74","endLine":23,"endColumn":19},{"ruleId":"71","severity":1,"message":"94","line":23,"column":21,"nodeType":"73","messageId":"74","endLine":23,"endColumn":31},{"ruleId":"78","severity":1,"message":"95","line":65,"column":8,"nodeType":"80","endLine":65,"endColumn":10,"suggestions":"96"},{"ruleId":"78","severity":1,"message":"97","line":36,"column":6,"nodeType":"80","endLine":36,"endColumn":8,"suggestions":"98"},"no-native-reassign",["99"],"no-negated-in-lhs",["100"],"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'error' is assigned a value but never used.","'getBookmark' is defined but never used.","'response' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.","ArrayExpression",["101"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["102"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'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.","'state' is assigned a value but never used.","'setState' is assigned a value but never used.","'showSet' is assigned a value but never used.","'setShowSet' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.",["103"],"React Hook useEffect has missing dependencies: 'getReview' and 'infiniteScroll'. Either include them or remove the dependency array.",["104"],"no-global-assign","no-unsafe-negation",{"desc":"105","fix":"106"},{"desc":"107","fix":"108"},{"desc":"109","fix":"110"},{"desc":"111","fix":"112"},"Update the dependencies array to be: [getAssociation]",{"range":"113","text":"114"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"115","text":"116"},"Update the dependencies array to be: [getBookmark]",{"range":"117","text":"118"},"Update the dependencies array to be: [getReview, infiniteScroll]",{"range":"119","text":"120"},[1853,1855],"[getAssociation]",[2762,2769],"[getAssociation, props.history, search, state]",[2278,2280],"[getBookmark]",[1178,1180],"[getReview, infiniteScroll]"] [{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js":"3","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js":"5","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js":"6","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js":"7","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js":"8","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js":"9","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js":"10"},{"size":1339,"mtime":1612133560398,"results":"11","hashOfConfig":"12"},{"size":375,"mtime":1611254909401,"results":"13","hashOfConfig":"12"},{"size":3725,"mtime":1612133560393,"results":"14","hashOfConfig":"12"},{"size":8433,"mtime":1612154572467,"results":"15","hashOfConfig":"12"},{"size":4773,"mtime":1612146987427,"results":"16","hashOfConfig":"12"},{"size":438,"mtime":1612133560394,"results":"17","hashOfConfig":"12"},{"size":3150,"mtime":1612140232971,"results":"18","hashOfConfig":"12"},{"size":2959,"mtime":1612133560395,"results":"19","hashOfConfig":"12"},{"size":6367,"mtime":1612154452722,"results":"20","hashOfConfig":"12"},{"size":766,"mtime":1612140214129,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"13y9yvi",{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js",[],["43","44"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js",["45","46","47","48","49","50","51"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js",["52","53","54","55","56"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js",[],{"ruleId":"57","replacedBy":"58"},{"ruleId":"59","replacedBy":"60"},{"ruleId":"61","severity":1,"message":"62","line":4,"column":83,"nodeType":"63","messageId":"64","endLine":4,"endColumn":86},{"ruleId":"61","severity":1,"message":"65","line":22,"column":12,"nodeType":"63","messageId":"64","endLine":22,"endColumn":17},{"ruleId":"61","severity":1,"message":"66","line":24,"column":20,"nodeType":"63","messageId":"64","endLine":24,"endColumn":31},{"ruleId":"61","severity":1,"message":"67","line":26,"column":19,"nodeType":"63","messageId":"64","endLine":26,"endColumn":27},{"ruleId":"68","severity":1,"message":"69","line":48,"column":8,"nodeType":"70","endLine":48,"endColumn":10,"suggestions":"71"},{"ruleId":"68","severity":1,"message":"72","line":74,"column":8,"nodeType":"70","endLine":74,"endColumn":15,"suggestions":"73"},{"ruleId":"74","severity":1,"message":"75","line":146,"column":35,"nodeType":"76","endLine":146,"endColumn":76},{"ruleId":"61","severity":1,"message":"77","line":1,"column":10,"nodeType":"78","messageId":"64","endLine":1,"endColumn":15},{"ruleId":"61","severity":1,"message":"79","line":4,"column":21,"nodeType":"63","messageId":"64","endLine":4,"endColumn":24},{"ruleId":"61","severity":1,"message":"80","line":4,"column":26,"nodeType":"63","messageId":"64","endLine":4,"endColumn":32},{"ruleId":"68","severity":1,"message":"81","line":55,"column":6,"nodeType":"70","endLine":55,"endColumn":8,"suggestions":"82"},{"ruleId":"83","severity":1,"message":"84","line":134,"column":11,"nodeType":"85","endLine":134,"endColumn":23},"no-native-reassign",["86"],"no-negated-in-lhs",["87"],"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'error' is assigned a value but never used.","'getBookmark' is defined but never used.","'response' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.","ArrayExpression",["88"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["89"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'kakao' is defined but never used.","Program","'Row' is defined but never used.","'Button' is defined but never used.","React Hook useEffect has missing dependencies: 'getReview' and 'infiniteScroll'. Either include them or remove the dependency array.",["90"],"jsx-a11y/anchor-is-valid","The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","no-global-assign","no-unsafe-negation",{"desc":"91","fix":"92"},{"desc":"93","fix":"94"},{"desc":"95","fix":"96"},"Update the dependencies array to be: [getAssociation]",{"range":"97","text":"98"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"99","text":"100"},"Update the dependencies array to be: [getReview, infiniteScroll]",{"range":"101","text":"102"},[1853,1855],"[getAssociation]",[2762,2769],"[getAssociation, props.history, search, state]",[1829,1831],"[getReview, infiniteScroll]"]
\ No newline at end of file \ No newline at end of file
import React, { useState, useEffect } from 'react'
import { Col, Card, Container, Row, Button, Nav, Navbar, Image } from "react-bootstrap"
import axios from "axios"
import catchErrors from './utils/catchErrors.js'
import { isAuthenticated } from './utils/auth'
import * as Icon from 'react-bootstrap-icons';
import { Link } from 'react-router-dom'
import ohuh from './ohuh-sm.PNG';
const INIT_PAGE = {
bookmark: []
}
function Bookmark() {
const [page, setPage] = useState(INIT_PAGE)
const [index, setIndex] = useState(1);
const [error, setError] = useState('')
const [state, setState] = useState(false);
const [bookmark, setBookmark] = useState([true, true, true, true])
const [pagePlace, setPagePlace] = useState([])
const [showSet, setShowSet] = useState([false, false, false, false]);
const user = isAuthenticated()
async function getBookmark() {
try {
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
setPagePlace(response.data.bookmark)
} catch (error) {
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}&place=${pagePlace[index]._id}`)
alert(response.data, '저장된 북마크가 삭제되었습니다.')
const showArr = bookmark
showArr[index] = false
setBookmark(showArr)
console.log("bookmark=", bookmark)
} catch (error) {
catchErrors(error, setError)
}
}
}
useEffect(() => {
getBookmark()
}, [])
return (
<Container>
<Link to="/" className="d-flex justify-content-center">
<Image style={{ margin: "1%" }} src={ohuh} />
</Link>
<Navbar bg="info" variant="dark">
<Navbar.Brand href="/">북마크</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Link href="/">Home</Nav.Link>
</Nav>
</Navbar>
<Row className="d-flex flex-wrap">
{console.log("#####################33", pagePlace)}
{pagePlace.map((place, index) => {
return (
<Col key={index} md={6} >
<Card align="center" border="info" style={{ margin: "3%" }}>
<Card.Header className="d-flex justify-content-center" style={{ margin: "0", fontSize: '200%', fontWeight: 'bold' }} >{place.name}
{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.Header>
<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>
<Link to={`/place?id=${1}&place=${place.name}`} >
<Button variant="info"> {place.name} 자세히 살펴보기</Button>
</Link>
</Card.Body>
</Card>
</Col>
)
})}
</Row>
</Container >
)
}
export default Bookmark
// async function handleSubmit(e){
// setState(true); //버튼이 눌려서 handlesubmit이될때 setState값이 true로 바뀐다
// try { //respons 서버에 post로 요청하여 데이터를 받아온다
// const response = await axios.post('/api/users/bookmark', page)
// setSuccess(true)
// } catch (error) {
// console.log(error)
// catchErrors(error, setError)
// }
// }
// useEffect(() => {
// getBookmark(user)
// }, [user])
\ No newline at end of file
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