Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
search-page
Commits
c368c2c6
Commit
c368c2c6
authored
Jan 30, 2021
by
Lee SeoYeon
Browse files
.
parent
d0ed12bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
client/.eslintcache
View file @
c368c2c6
[{
"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"
:
1684
,
"mtime"
:
1611733806708
,
"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"
:
10940
,
"mtime"
:
1611733806665
,
"results"
:
"24"
,
"hashOfConfig"
:
"14"
},{
"size"
:
5379
,
"mtime"
:
1611733806683
,
"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"
:
"50"
,
"usedDeprecatedRules"
:
"28"
},{
"filePath"
:
"51"
,
"messages"
:
"52"
,
"errorCount"
:
1
,
"warningCount"
:
0
,
"fixableErrorCount"
:
0
,
"fixableWarningCount"
:
0
,
"source"
:
null
},
"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\n
import React, { useEffect, useState } from 'react';
\r\n
import { Modal, Container, Row, Button, } from 'react-bootstrap';
\r\n\r\n
function 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\n
export 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"
],
"C:
\\
Users
\\
hello
\\
Desktop
\\
project
\\
search-page
\\
client
\\
src
\\
Pages
\\
Search.js"
,[
"68"
,
"69"
,
"70"
,
"71"
,
"72"
,
"73"
,
"74"
,
"75"
,
"76"
,
"77"
,
"78"
,
"79"
,
"80"
],
"import React, { useState, useEffect } from 'react';
\r\n
import { Link } from 'react-router-dom';
\r\n
import ohuh from '../ohuh-sm.PNG';
\r\n
import Place from '../Components/Place';
\r\n
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button, Nav } from 'react-bootstrap';
\r\n
import Paginations from '../Components/Paginations';
\r\n
import axios from 'axios';
\r\n
import queryString from 'query-string'
\r\n
import * as Icon from 'react-bootstrap-icons';
\r\n
import { isAuthenticated } from '../utils/auth';
\r\n
import catchErrors from '../utils/catchErrors'
\r\n\r\n
function Search(props) {\r
\n\r\n
const [state, setState] = useState(false);
\r\n
const [index, setIndex] = useState(1);
\r\n
const [showSet, setShowSet] = useState([false, false, false, false]);
\r\n
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
\r\n
const [bookmark, setBookmark] = useState([false, false, false, false])
\r\n
const user = isAuthenticated()
\r\n
const [mobile, setMobile] = useState();
\r\n
const [association, setAssociation] = useState([{ name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}])
\r\n
const [pagePlace, setPagePlace] = useState([{ name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}, { name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}])
\r\n
const [endPage, setEndPage] = useState(1)
\r\n
const [error, setError] = useState('')
\r\n\r\n
async function getBookmark() {\r
\n
try {\r
\n
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
\r\n
// setBookmark(response.data.bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n\r\n
const getAssociation = () => {\r
\n
axios.get(`/api/search/association?keyword=${search}`)
\r\n
.then(res => {\r
\n
console.log(
\"
Associations =
\"
, res.data)
\r\n
setAssociation(res.data)
\r\n
})
\r\n
.catch(err => {\r
\n
console.log(
\"
search.associations 에러 발생
\"
, err)
\r\n
})
\r\n
}
\r\n\r\n\r\n\r\n
useEffect(() => {\r
\n
getAssociation()
\r\n
}, []);
\r\n\r\n
useEffect(() => {\r
\n
if (association.length < 3) {\r
\n
setPagePlace(paginate(association, index, association.length))
\r\n
}
\r\n
else {\r
\n
setPagePlace(paginate(association, index, 4))
\r\n
}
\r\n
setEndPage(Math.floor((association.length / 4)))
\r\n\r\n
}, [association, index])
\r\n\r\n
useEffect(() => {\r
\n
getAssociation()
\r\n
if (state) {\r
\n
// window.location.reload()
\r\n
// return <Redirect to={{\r
\n
// pathname: `/search?keyword=${search}`,
\r\n
// state: { id: search },
\r\n
// }} />;
\r\n
props.history.push('/search?keyword=' + search)
\r\n
setState(false)
\r\n
// console.log(
\"
search야
\"
, search)
\r\n
} window.addEventListener(
\"
scroll
\"
, infiniteScroll);
\r\n
return () => { window.removeEventListener(
\"
scroll
\"
, infiniteScroll); }
\r\n
}, [state]);
\r\n\r\n
const infiniteScroll = () => {\r
\n
const { documentElement, body } = document;
\r\n
const scrollHeight = Math.max(documentElement.scrollHeight, body.scrollHeight);
\r\n
const scrollTop = Math.max(documentElement.scrollTop, body.scrollTop);
\r\n
const clientHeight = documentElement.clientHeight;
\r\n
if (scrollTop + clientHeight >= scrollHeight) {\r
\n
// getReview();
\r\n
console.log(
\"
더불러
\"
)
\r\n
}
\r\n
console.log(scrollHeight, scrollTop, clientHeight)
\r\n
}
\r\n\r\n\r\n
const places = [{\r
\n
name:
\"
한라산
\"
,
\r\n
address:
\"
제주 서귀포시 토평동 산15-1
\"
,
\r\n
img:
\"
https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg?size=200x200
\"
,
\r\n
}, {\r
\n
name:
\"
성산일출봉(sungsan)
\"
,
\r\n
address:
\"
제주 서귀포시 성산읍 성산리 1
\"
,
\r\n
img:
\"
https://www.jeju.go.kr/pub/site/geopark/images/sub/sub03/02%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84%EC%9D%B4%EC%95%BC%EA%B8%B0/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84_%EC%84%B1%EC%82%B0%EC%9D%BC%EC%B6%9C%EB%B4%89/1412402261.jpg?400/400
\"
,
\r\n
}, {\r
\n
name:
\"
해녀의 집(haenyeo)
\"
,
\r\n
address:
\"
제주 서귀포시 성산읍 한도로 141-13지번오조리 3 오조해녀의집
\"
,
\r\n
img:
\"
https://mblogthumb-phinf.pstatic.net/MjAxNjExMTdfMTc0/MDAxNDc5MzU3ODU0ODQy.KZYXCjzsXT3rCsE4HXBfxyCg2buvluBvN_7NxVp7BSwg.loJc89d8JjGXdNCn-4yMd7aMWPjfrZn21TI9Hyzemkog.JPEG.icocam11/20161010_100205.jpg?type=w800
\"
,
\r\n
}, {\r
\n
name:
\"
오설록 티 뮤지엄(osulloc)
\"
,
\r\n
address:
\"
제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록
\"
,
\r\n
img:
\"
https://cdnweb01.wikitree.co.kr/webdata/editor/202007/01/img_20200701143323_2ced7627.webp
\"
,
\r\n
}, {\r
\n
name:
\"
오설록 티 뮤지엄(osulloc)
\"
,
\r\n
address:
\"
제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록
\"
,
\r\n
img:
\"
https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg
\"
,
\r\n
}]
\r\n\r\n
if (state !== false) {\r
\n
// console.log(queryString.parse(props.location.search))
\r\n
// =
{
keyword:search
}
\r\n
// return <Redirect to={{\r
\n
// pathname: `/search?keyword=${search}`,
\r\n
// state: { id: search },
\r\n
// }} />;
\r\n
// history.pushState(null, null,
\"
?
\"
+queryParams.toString());
\r\n
// return <Redirect to=
{
`/search?keyword=${search}`
}
/>;
\r\n
}
\r\n\r\n
const handlePage = (num) => {\r
\n
setIndex(num);
\r\n
console.log(
\"
pagenation num
\"
, num)
\r\n
console.log(index)
\r\n
}
\r\n\r\n\r\n
const handleChange = (e) => {\r
\n
setSearch(e.target.value);
\r\n
}
\r\n\r\n
const handleSubmit = (e) => {\r
\n
e.preventDefault()
\r\n
setState(true)
\r\n
setIndex(1)
\r\n
}
\r\n\r\n
function paginate(items, pageNumber, itemNumber) {\r
\n
const page = [];
\r\n
const startIndex = (pageNumber - 1) * itemNumber
\r\n
for (var i = 0; i < itemNumber; i++) {\r
\n\r\n
page.push(items[(startIndex + i)])
\r\n
}
\r\n
console.log(
\"
뿌릴 data22222222222222222
\"
, page)
\r\n
return page
\r\n
}
\r\n
//usestate 쓰거나 한번에 useeffect에 넣기
\r\n\r\n
async function handlebookmark(index) {\r
\n
if (!bookmark[index]) {\r
\n
console.log(pagePlace[index])
\r\n
try {\r
\n
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
\r\n
alert(response.data, '북마크가 저장되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = true
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
} else {\r
\n
try {\r
\n
const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
\r\n
alert(response.data, '저장된 북마크가 삭제되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = false
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n
}
\r\n\r\n\r\n
let time = new Date()
\r\n\r\n
return (
\r\n
<Container >
\r\n
<Link to=
\"
/
\"
className=
\"
d-flex justify-content-center
\"
><Image src=
{
ohuh
}
/></Link>
\r\n
<Row className=
\"
mb-2
\"
className=
\"
d-flex justify-content-center
\"
>
\r\n
<Form style={{ width:
\"
90vw
\"
}} onSubmit=
{
handleSubmit
}
>
\r\n
<InputGroup size=
\"
lg
\"
>
\r\n
<FormControl
\r\n
placeholder=
\"
검색어를 입력하세요.
\"\r\n
value=
{
search
}
\r\n
aria-label=
\"
Large
\"\r\n
aria-describedby=
\"
inputGroup-sizing-sm
\"\r\n
onChange=
{
handleChange
}
\r\n
/>
\r\n
<InputGroup.Append>
\r\n
<Button type=
\"
submit
\"
variant=
\"
outline-secondary
\"
>검색</Button>
\r\n
</InputGroup.Append>
\r\n
</InputGroup>
\r\n
</Form>
\r\n
</Row>
\r\n
{/*
{
time.toLocaleString()
}
*/}
\r\n
<Row className=
\"
d-flex flex-wrap
\"
>
\r\n\r\n
{console.log(
\"
#####################33
\"
, pagePlace)}
\r\n
{pagePlace.map((place, index) => {\r
\n
return (
\r\n
<Col key=
{
index
}
md=
{
6
}
>
\r\n
<Card align=
\"
center
\"
border=
\"
info
\"
style={{ margin:
\"
3%
\"
}}>
\r\n\r\n
<Card.Title className=
\"
d-flex justify-content-center
\"
style={{ margin:
\"
3%
\"
, fontSize: '200%', fontWeight: 'bold' }} >
{
place.name
}
\r\n
{user ?
\r\n
<Button
\r\n
variant={bookmark[index] ?
\"
primary
\"
:
\"
light
\"
}
\r\n
onClick={() => handlebookmark(index, place)}>
\r\n
<Icon.BookmarkStarFill size=
{
35
}
/>
\r\n
{console.log(
\"
bookmark
\"
, bookmark)}
\r\n
{console.log(
\"
bookmark[index]
\"
, bookmark[index])}</Button> : null}
\r\n
</Card.Title>
\r\n
<Card.Img variant=
\"
top
\"
style={{ padding:
\"
5%
\"
, width:
\"
100%
\"
, height:
\"
340px
\"
}} src=
{
place.img
}
/>
\r\n
<Card.Body >
\r\n
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height:
\"
80px
\"
}} >
\r\n
{
place.address
}
</Card.Text>
\r\n
<Button variant=
\"
info
\"
onClick={() => {\r
\n
const showArr = [false, false, false, false]
\r\n
showArr[index] = true
\r\n
setShowSet(showArr)
\r\n
}}>
{
place.name
}
자세히 살펴보기</Button>
\r\n
<Place place=
{
place
}
index=
{
index
}
show=
{
showSet[index]
}
onHide={() => setShowSet([false, false, false, false])} />
\r\n
</Card.Body>
\r\n
</Card>
\r\n
</Col>
\r\n
)
\r\n
})}
\r\n\r\n\r\n
</Row>
\r\n
<Row className=
\"
mt-2 d-flex justify-content-center
\"
>
\r\n
<Paginations index=
{
index
}
endPage=
{
endPage
}
handlePage=
{
handlePage
}
></Paginations>
\r\n
</Row>
\r\n
</Container >
\r\n
);
\r\n
}
\r\n\r\n
export default Search;
\r\n
"
,
"C:
\\
Users
\\
hello
\\
Desktop
\\
project
\\
search-page
\\
client
\\
src
\\
Pages
\\
App.js"
,[
"81"
],{
"ruleId"
:
"82"
,
"replacedBy"
:
"83"
},{
"ruleId"
:
"84"
,
"replacedBy"
:
"85"
},{
"ruleId"
:
"86"
,
"severity"
:
1
,
"message"
:
"87"
,
"line"
:
23
,
"column"
:
6
,
"nodeType"
:
"88"
,
"endLine"
:
23
,
"endColumn"
:
8
,
"suggestions"
:
"89"
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"91"
,
"line"
:
2
,
"column"
:
10
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
2
,
"endColumn"
:
15
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"94"
,
"line"
:
2
,
"column"
:
39
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
2
,
"endColumn"
:
43
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"95"
,
"line"
:
7
,
"column"
:
8
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
7
,
"endColumn"
:
13
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"96"
,
"line"
:
16
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
16
,
"endColumn"
:
16
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"97"
,
"line"
:
16
,
"column"
:
18
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
16
,
"endColumn"
:
25
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"98"
,
"line"
:
17
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
17
,
"endColumn"
:
17
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"99"
,
"line"
:
17
,
"column"
:
19
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
17
,
"endColumn"
:
27
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"100"
,
"line"
:
18
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
18
,
"endColumn"
:
17
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"101"
,
"line"
:
19
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
19
,
"endColumn"
:
17
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"102"
,
"line"
:
19
,
"column"
:
19
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
19
,
"endColumn"
:
27
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"103"
,
"line"
:
22
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
22
,
"endColumn"
:
19
},{
"ruleId"
:
"86"
,
"severity"
:
1
,
"message"
:
"104"
,
"line"
:
64
,
"column"
:
8
,
"nodeType"
:
"88"
,
"endLine"
:
64
,
"endColumn"
:
10
,
"suggestions"
:
"105"
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"106"
,
"line"
:
2
,
"column"
:
16
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
2
,
"endColumn"
:
24
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"107"
,
"line"
:
5
,
"column"
:
83
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
5
,
"endColumn"
:
86
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"108"
,
"line"
:
21
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
21
,
"endColumn"
:
18
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"109"
,
"line"
:
21
,
"column"
:
20
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
21
,
"endColumn"
:
29
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"100"
,
"line"
:
25
,
"column"
:
12
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
25
,
"endColumn"
:
17
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"110"
,
"line"
:
27
,
"column"
:
20
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
27
,
"endColumn"
:
31
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"111"
,
"line"
:
29
,
"column"
:
19
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
29
,
"endColumn"
:
27
},{
"ruleId"
:
"86"
,
"severity"
:
1
,
"message"
:
"112"
,
"line"
:
51
,
"column"
:
8
,
"nodeType"
:
"88"
,
"endLine"
:
51
,
"endColumn"
:
10
,
"suggestions"
:
"113"
},{
"ruleId"
:
"86"
,
"severity"
:
1
,
"message"
:
"114"
,
"line"
:
64
,
"column"
:
8
,
"nodeType"
:
"88"
,
"endLine"
:
64
,
"endColumn"
:
28
,
"suggestions"
:
"115"
},{
"ruleId"
:
"86"
,
"severity"
:
1
,
"message"
:
"116"
,
"line"
:
79
,
"column"
:
8
,
"nodeType"
:
"88"
,
"endLine"
:
79
,
"endColumn"
:
15
,
"suggestions"
:
"117"
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"118"
,
"line"
:
94
,
"column"
:
11
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
94
,
"endColumn"
:
17
},{
"ruleId"
:
"90"
,
"severity"
:
1
,
"message"
:
"119"
,
"line"
:
184
,
"column"
:
9
,
"nodeType"
:
"92"
,
"messageId"
:
"93"
,
"endLine"
:
184
,
"endColumn"
:
13
},{
"ruleId"
:
"120"
,
"severity"
:
1
,
"message"
:
"121"
,
"line"
:
189
,
"column"
:
35
,
"nodeType"
:
"122"
,
"endLine"
:
189
,
"endColumn"
:
76
},{
"ruleId"
:
null
,
"fatal"
:
true
,
"severity"
:
2
,
"message"
:
"123"
,
"line"
:
3
,
"column"
:
2
},
"no-native-reassign"
,[
"124"
],
"no-negated-in-lhs"
,[
"125"
],
"react-hooks/exhaustive-deps"
,
"React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array."
,
"ArrayExpression"
,[
"126"
],
"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."
,[
"127"
],
"'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."
,[
"128"
],
"React Hook useEffect has missing dependencies: 'endPage' and 'pagePlace'. Either include them or remove the dependency array."
,[
"129"
],
"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array."
,[
"130"
],
"'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"
,
"Parsing error: Unexpected token
\n\n
\u001b[0m \u001b[90m 1 | \u001b[39m\u001b[36mimport\u001b[39m \u001b[33mReact\u001b[39m\u001b[33m,\u001b[39m { useState\u001b[33m,\u001b[39m useEffect } from \u001b[32m'react'\u001b[39m\u001b[33m;\u001b[39m\u001b[0m
\n
\u001b[0m \u001b[90m 2 | \u001b[39m\u001b[36mimport\u001b[39m { \u001b[33mRedirect\u001b[39m } from \u001b[32m'react-router-dom'\u001b[39m\u001b[33m;\u001b[39m\u001b[0m
\n
\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 3 | \u001b[39m\u001b[33m<<\u001b[39m\u001b[33m<<\u001b[39m\u001b[33m<<\u001b[39m\u001b[33m<\u001b[39m \u001b[33mHEAD\u001b[39m\u001b[0m
\n
\u001b[0m \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m
\n
\u001b[0m \u001b[90m 4 | \u001b[39m\u001b[36mimport\u001b[39m ohuh from \u001b[32m'../ohuh.PNG'\u001b[39m\u001b[0m
\n
\u001b[0m \u001b[90m 5 | \u001b[39m\u001b[36mimport\u001b[39m { \u001b[33mContainer\u001b[39m\u001b[33m,\u001b[39m \u001b[33mRow\u001b[39m\u001b[33m,\u001b[39m \u001b[33mForm\u001b[39m\u001b[33m,\u001b[39m \u001b[33mImage\u001b[39m\u001b[33m,\u001b[39m \u001b[33mInputGroup\u001b[39m\u001b[33m,\u001b[39m \u001b[33mButton\u001b[39m\u001b[33m,\u001b[39m \u001b[33mCol\u001b[39m\u001b[33m,\u001b[39m \u001b[33mNav\u001b[39m } from \u001b[32m'react-bootstrap'\u001b[39m\u001b[33m;\u001b[39m\u001b[0m
\n
\u001b[0m \u001b[90m 6 | \u001b[39m\u001b[36mimport\u001b[39m { handleLogout\u001b[33m,\u001b[39m isAuthenticated } from \u001b[32m'../utils/auth.js'\u001b[39m\u001b[0m"
,
"no-global-assign"
,
"no-unsafe-negation"
,{
"desc"
:
"131"
,
"fix"
:
"132"
},{
"desc"
:
"133"
,
"fix"
:
"134"
},{
"desc"
:
"135"
,
"fix"
:
"136"
},{
"desc"
:
"137"
,
"fix"
:
"138"
},{
"desc"
:
"139"
,
"fix"
:
"140"
},
"Update the dependencies array to be: [getReview]"
,{
"range"
:
"141"
,
"text"
:
"142"
},
"Update the dependencies array to be: [getBookmark]"
,{
"range"
:
"143"
,
"text"
:
"144"
},
"Update the dependencies array to be: [getAssociation]"
,{
"range"
:
"145"
,
"text"
:
"146"
},
"Update the dependencies array to be: [association, endPage, index, pagePlace]"
,{
"range"
:
"147"
,
"text"
:
"148"
},
"Update the dependencies array to be: [getAssociation, props.history, search, state]"
,{
"range"
:
"149"
,
"text"
:
"150"
},[
665
,
667
],
"[getReview]"
,[
2225
,
2227
],
"[getBookmark]"
,[
2018
,
2020
],
"[getAssociation]"
,[
2418
,
2438
],
"[association, endPage, index, pagePlace]"
,[
3017
,
3024
],
"[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"
:
1684
,
"mtime"
:
1611733806708
,
"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"
:
9065
,
"mtime"
:
1611734932471
,
"results"
:
"24"
,
"hashOfConfig"
:
"14"
},{
"size"
:
4299
,
"mtime"
:
1611734226422
,
"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"
:
"48"
,
"usedDeprecatedRules"
:
"28"
},{
"filePath"
:
"49"
,
"messages"
:
"50"
,
"errorCount"
:
0
,
"warningCount"
:
10
,
"fixableErrorCount"
:
0
,
"fixableWarningCount"
:
0
,
"source"
:
"51"
,
"usedDeprecatedRules"
:
"28"
},{
"filePath"
:
"52"
,
"messages"
:
"53"
,
"errorCount"
:
0
,
"warningCount"
:
0
,
"fixableErrorCount"
:
0
,
"fixableWarningCount"
:
0
,
"usedDeprecatedRules"
:
"28"
},
"C:
\\
Users
\\
hello
\\
Desktop
\\
project
\\
search-page
\\
client
\\
src
\\
index.js"
,[],[
"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"
],
"import axios from 'axios';
\r\n
import React, { useEffect, useState } from 'react';
\r\n
import { Modal, Container, Row, Button, } from 'react-bootstrap';
\r\n\r\n
function 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\n
export 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"
,[
"57"
,
"58"
,
"59"
,
"60"
,
"61"
,
"62"
,
"63"
,
"64"
,
"65"
,
"66"
,
"67"
,
"68"
],
"import React, { useState, useEffect } from 'react'
\r\n
import { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar } from
\"
react-bootstrap
\"\r\n
import axios from
\"
axios
\"\r\n
import catchErrors from './utils/catchErrors.js'
\r\n
import { isAuthenticated } from './utils/auth'
\r\n
import * as Icon from 'react-bootstrap-icons';
\r\n
import Place from './Components/Place.js'
\r\n\r\n\r\n
const INIT_PAGE = {\r
\n
bookmark: []
\r\n
}
\r\n\r\n\r\n
function Bookmark() {\r
\n
const [page, setPage] = useState(INIT_PAGE)
\r\n
const [index, setIndex] = useState(1);
\r\n
const [error, setError] = useState('')
\r\n
const [state, setState] = useState(false);
\r\n
const [bookmark, setBookmark] = useState([false, false, false, false])
\r\n
const [pagePlace, setPagePlace] = useState([])
\r\n
const [showSet, setShowSet] = useState([false, false, false, false]);
\r\n\r\n
const user = isAuthenticated()
\r\n\r\n
async function getBookmark() {\r
\n
try {\r
\n
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
\r\n
setPagePlace(response.data.bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n\r\n\r\n
async function handleBookmark(index) {\r
\n
if (!bookmark[index]) {\r
\n
console.log(pagePlace[index])
\r\n
try {\r
\n
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
\r\n
alert(response.data, '북마크가 저장되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = true
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
} else {\r
\n
try {\r
\n
const response = await axios.delete(`/api/users/bookmark?ID=${user}`)
\r\n
alert(response.data, '저장된 북마크가 삭제되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = false
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n
}
\r\n
useEffect(() => {\r
\n
getBookmark()
\r\n
}, [])
\r\n\r\n\r\n
return (
\r\n
<Container>
\r\n
<Navbar bg=
\"
info
\"
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
</Navbar>
\r\n
<Row className=
\"
d-flex flex-wrap
\"
>
\r\n
{console.log(
\"
#####################33
\"
, pagePlace)}
\r\n
{pagePlace.map((place, index) => {\r
\n
return (
\r\n
<Col key=
{
index
}
md=
{
6
}
>
\r\n
<Card align=
\"
center
\"
border=
\"
info
\"
style={{ margin:
\"
3%
\"
}}>
\r\n\r\n
<Card.Title className=
\"
d-flex justify-content-center
\"
style={{ margin:
\"
3%
\"
, fontSize: '200%', fontWeight: 'bold' }} >
{
place.name
}
\r\n
{user ?
\r\n
<Button
\r\n
variant={bookmark[index] ?
\"
primary
\"
:
\"
light
\"
}
\r\n
onClick={() => handleBookmark(index, place)}>
\r\n
<Icon.BookmarkStarFill size=
{
35
}
/>
\r\n
{console.log(
\"
bookmark
\"
, bookmark)}
\r\n
{console.log(
\"
bookmark[index]
\"
, bookmark[index])}</Button> : null}
\r\n
</Card.Title>
\r\n
<Card.Img variant=
\"
top
\"
style={{ padding:
\"
5%
\"
, width:
\"
100%
\"
, height:
\"
340px
\"
}} src=
{
place.img
}
/>
\r\n
<Card.Body >
\r\n
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height:
\"
80px
\"
}} >
\r\n
{
place.address
}
</Card.Text>
\r\n
<Button variant=
\"
info
\"
onClick={() => {\r
\n
const showArr = [false, false, false, false]
\r\n
showArr[index] = true
\r\n
setShowSet(showArr)
\r\n
}}>
{
place.name
}
자세히 살펴보기</Button>
\r\n
{/* <Place place=
{
place
}
index=
{
index
}
show=
{
showSet[index]
}
onHide={() => setShowSet([false, false, false, false])} /> */}
\r\n
</Card.Body>
\r\n
</Card>
\r\n
</Col>
\r\n
)
\r\n
})}
\r\n\r\n\r\n
</Row>
\r\n
</Container>
\r\n
)
\r\n
}
\r\n\r\n
export 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"
,[
"69"
,
"70"
,
"71"
,
"72"
,
"73"
,
"74"
,
"75"
,
"76"
,
"77"
,
"78"
],
"import React, { useState, useEffect } from 'react';
\r\n
import { Link } from 'react-router-dom';
\r\n
import ohuh from '../ohuh-sm.PNG';
\r\n
import Place from '../Components/Place';
\r\n
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button, Nav } from 'react-bootstrap';
\r\n
import Paginations from '../Components/Paginations';
\r\n
import axios from 'axios';
\r\n
import queryString from 'query-string'
\r\n
import * as Icon from 'react-bootstrap-icons';
\r\n
import { isAuthenticated } from '../utils/auth';
\r\n
import catchErrors from '../utils/catchErrors'
\r\n\r\n
function Search(props) {\r
\n\r\n
const [state, setState] = useState(false);
\r\n
const [index, setIndex] = useState(1);
\r\n
const [showSet, setShowSet] = useState([false, false, false, false]);
\r\n
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
\r\n
const [bookmark, setBookmark] = useState([false, false, false, false])
\r\n
const user = isAuthenticated()
\r\n
const [mobile, setMobile] = useState();
\r\n
const [association, setAssociation] = useState([{ name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}])
\r\n
const [pagePlace, setPagePlace] = useState([{ name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}, { name:
\"
\"
, address:
\"
\"
, img:
\"
\"
}])
\r\n
const [endPage, setEndPage] = useState(1)
\r\n
const [error, setError] = useState('')
\r\n\r\n
async function getBookmark() {\r
\n
try {\r
\n
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
\r\n
// setBookmark(response.data.bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n\r\n
const getAssociation = () => {\r
\n
axios.get(`/api/search/association?keyword=${search}`)
\r\n
.then(res => {\r
\n
console.log(
\"
Associations =
\"
, res.data)
\r\n
setAssociation(res.data)
\r\n
})
\r\n
.catch(err => {\r
\n
console.log(
\"
search.associations 에러 발생
\"
, err)
\r\n
})
\r\n
}
\r\n\r\n\r\n\r\n
useEffect(() => {\r
\n
getAssociation()
\r\n
}, []);
\r\n\r\n
useEffect(() => {\r
\n
if (association.length < 3) {\r
\n
setPagePlace(paginate(association, index, association.length))
\r\n
}
\r\n
else {\r
\n
setPagePlace(paginate(association, index, 4))
\r\n
}
\r\n
setEndPage(Math.floor((association.length / 4)))
\r\n\r\n
}, [association, index])
\r\n\r\n
useEffect(() => {\r
\n
getAssociation()
\r\n
if (state) {\r
\n
// window.location.reload()
\r\n
// return <Redirect to={{\r
\n
// pathname: `/search?keyword=${search}`,
\r\n
// state: { id: search },
\r\n
// }} />;
\r\n
props.history.push('/search?keyword=' + search)
\r\n
setState(false)
\r\n
// console.log(
\"
search야
\"
, search)
\r\n
} window.addEventListener(
\"
scroll
\"
, infiniteScroll);
\r\n
return () => { window.removeEventListener(
\"
scroll
\"
, infiniteScroll); }
\r\n
}, [state]);
\r\n\r\n
const infiniteScroll = () => {\r
\n
const { documentElement, body } = document;
\r\n
const scrollHeight = Math.max(documentElement.scrollHeight, body.scrollHeight);
\r\n
const scrollTop = Math.max(documentElement.scrollTop, body.scrollTop);
\r\n
const clientHeight = documentElement.clientHeight;
\r\n
if (scrollTop + clientHeight >= scrollHeight) {\r
\n
// getReview();
\r\n
console.log(
\"
더불러
\"
)
\r\n
}
\r\n
console.log(scrollHeight, scrollTop, clientHeight)
\r\n
}
\r\n\r\n\r\n
if (state !== false) {\r
\n
// console.log(queryString.parse(props.location.search))
\r\n
// =
{
keyword:search
}
\r\n
// return <Redirect to={{\r
\n
// pathname: `/search?keyword=${search}`,
\r\n
// state: { id: search },
\r\n
// }} />;
\r\n
// history.pushState(null, null,
\"
?
\"
+queryParams.toString());
\r\n
// return <Redirect to=
{
`/search?keyword=${search}`
}
/>;
\r\n
}
\r\n\r\n
const handlePage = (num) => {\r
\n
setIndex(num);
\r\n
console.log(
\"
pagenation num
\"
, num)
\r\n
console.log(index)
\r\n
}
\r\n\r\n\r\n
const handleChange = (e) => {\r
\n
setSearch(e.target.value);
\r\n
}
\r\n\r\n
const handleSubmit = (e) => {\r
\n
e.preventDefault()
\r\n
setState(true)
\r\n
setIndex(1)
\r\n
}
\r\n\r\n
function paginate(items, pageNumber, itemNumber) {\r
\n
const page = [];
\r\n
const startIndex = (pageNumber - 1) * itemNumber
\r\n
for (var i = 0; i < itemNumber; i++) {\r
\n\r\n
page.push(items[(startIndex + i)])
\r\n
}
\r\n
console.log(
\"
뿌릴 data22222222222222222
\"
, page)
\r\n
return page
\r\n
}
\r\n
//usestate 쓰거나 한번에 useeffect에 넣기
\r\n\r\n
async function handlebookmark(index) {\r
\n
if (!bookmark[index]) {\r
\n
console.log(pagePlace[index])
\r\n
try {\r
\n
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
\r\n
alert(response.data, '북마크가 저장되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = true
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
} else {\r
\n
try {\r
\n
const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
\r\n
alert(response.data, '저장된 북마크가 삭제되었습니다.')
\r\n
const showArr = bookmark
\r\n
showArr[index] = false
\r\n
setBookmark(showArr)
\r\n
console.log(
\"
bookmark=
\"
, bookmark)
\r\n
} catch (error) {\r
\n
catchErrors(error, setError)
\r\n
}
\r\n
}
\r\n
}
\r\n\r\n\r\n
let time = new Date()
\r\n\r\n
return (
\r\n
<Container >
\r\n
<Link to=
\"
/
\"
className=
\"
d-flex justify-content-center
\"
><Image src=
{
ohuh
}
/></Link>
\r\n
<Row className=
\"
mb-2
\"
className=
\"
d-flex justify-content-center
\"
>
\r\n
<Form style={{ width:
\"
90vw
\"
}} onSubmit=
{
handleSubmit
}
>
\r\n
<InputGroup size=
\"
lg
\"
>
\r\n
<FormControl
\r\n
placeholder=
\"
검색어를 입력하세요.
\"\r\n
value=
{
search
}
\r\n
aria-label=
\"
Large
\"\r\n
aria-describedby=
\"
inputGroup-sizing-sm
\"\r\n
onChange=
{
handleChange
}
\r\n
/>
\r\n
<InputGroup.Append>
\r\n
<Button type=
\"
submit
\"
variant=
\"
outline-secondary
\"
>검색</Button>
\r\n
</InputGroup.Append>
\r\n
</InputGroup>
\r\n
</Form>
\r\n
</Row>
\r\n
{/*
{
time.toLocaleString()
}
*/}
\r\n
<Row className=
\"
d-flex flex-wrap
\"
>
\r\n\r\n
{console.log(
\"
#####################33
\"
, pagePlace)}
\r\n
{pagePlace.map((place, index) => {\r
\n
return (
\r\n
<Col key=
{
index
}
md=
{
6
}
>
\r\n
<Card align=
\"
center
\"
border=
\"
info
\"
style={{ margin:
\"
3%
\"
}}>
\r\n\r\n
<Card.Title className=
\"
d-flex justify-content-center
\"
style={{ margin:
\"
3%
\"
, fontSize: '200%', fontWeight: 'bold' }} >
{
place.name
}
\r\n
{user ?
\r\n
<Button
\r\n
variant={bookmark[index] ?
\"
primary
\"
:
\"
light
\"
}
\r\n
onClick={() => handlebookmark(index, place)}>
\r\n
<Icon.BookmarkStarFill size=
{
35
}
/>
\r\n
</Button> : null}
\r\n
</Card.Title>
\r\n
<Card.Img variant=
\"
top
\"
style={{ padding:
\"
5%
\"
, width:
\"
100%
\"
, height:
\"
340px
\"
}} src=
{
place.img
}
/>
\r\n
<Card.Body >
\r\n
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height:
\"
80px
\"
}} >
\r\n
{
place.address
}
</Card.Text>
\r\n
<Button variant=
\"
info
\"
onClick={() => {\r
\n
const showArr = [false, false, false, false]
\r\n
showArr[index] = true
\r\n
setShowSet(showArr)
\r\n
}}>
{
place.name
}
자세히 살펴보기</Button>
\r\n
<Place place=
{
place
}
index=
{
index
}
show=
{
showSet[index]
}
onHide={() => setShowSet([false, false, false, false])} />
\r\n
</Card.Body>
\r\n
</Card>
\r\n
</Col>
\r\n
)
\r\n
})}
\r\n\r\n\r\n
</Row>
\r\n
<Row className=
\"
mt-2 d-flex justify-content-center
\"
>
\r\n
<Paginations index=
{
index
}
endPage=
{
endPage
}
handlePage=
{
handlePage
}
></Paginations>
\r\n
</Row>
\r\n
</Container >
\r\n
);
\r\n
}
\r\n\r\n
export default Search;
\r\n
"
,
"C:
\\
Users
\\
hello
\\
Desktop
\\
project
\\
search-page
\\
client
\\
src
\\
Pages
\\
App.js"
,[],{
"ruleId"
:
"79"
,
"replacedBy"
:
"80"
},{
"ruleId"
:
"81"
,
"replacedBy"
:
"82"
},{
"ruleId"
:
"83"
,
"severity"
:
1
,
"message"
:
"84"
,
"line"
:
23
,
"column"
:
6
,
"nodeType"
:
"85"
,
"endLine"
:
23
,
"endColumn"
:
8
,
"suggestions"
:
"86"
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"88"
,
"line"
:
2
,
"column"
:
10
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
2
,
"endColumn"
:
15
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"91"
,
"line"
:
2
,
"column"
:
39
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
2
,
"endColumn"
:
43
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"92"
,
"line"
:
7
,
"column"
:
8
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
7
,
"endColumn"
:
13
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"93"
,
"line"
:
16
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
16
,
"endColumn"
:
16
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"94"
,
"line"
:
16
,
"column"
:
18
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
16
,
"endColumn"
:
25
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"95"
,
"line"
:
17
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
17
,
"endColumn"
:
17
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"96"
,
"line"
:
17
,
"column"
:
19
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
17
,
"endColumn"
:
27
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"97"
,
"line"
:
18
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
18
,
"endColumn"
:
17
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"98"
,
"line"
:
19
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
19
,
"endColumn"
:
17
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"99"
,
"line"
:
19
,
"column"
:
19
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
19
,
"endColumn"
:
27
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"100"
,
"line"
:
22
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
22
,
"endColumn"
:
19
},{
"ruleId"
:
"83"
,
"severity"
:
1
,
"message"
:
"101"
,
"line"
:
64
,
"column"
:
8
,
"nodeType"
:
"85"
,
"endLine"
:
64
,
"endColumn"
:
10
,
"suggestions"
:
"102"
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"103"
,
"line"
:
5
,
"column"
:
83
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
5
,
"endColumn"
:
86
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"104"
,
"line"
:
21
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
21
,
"endColumn"
:
18
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"105"
,
"line"
:
21
,
"column"
:
20
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
21
,
"endColumn"
:
29
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"97"
,
"line"
:
25
,
"column"
:
12
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
25
,
"endColumn"
:
17
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"106"
,
"line"
:
27
,
"column"
:
20
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
27
,
"endColumn"
:
31
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"107"
,
"line"
:
29
,
"column"
:
19
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
29
,
"endColumn"
:
27
},{
"ruleId"
:
"83"
,
"severity"
:
1
,
"message"
:
"108"
,
"line"
:
51
,
"column"
:
8
,
"nodeType"
:
"85"
,
"endLine"
:
51
,
"endColumn"
:
10
,
"suggestions"
:
"109"
},{
"ruleId"
:
"83"
,
"severity"
:
1
,
"message"
:
"110"
,
"line"
:
77
,
"column"
:
8
,
"nodeType"
:
"85"
,
"endLine"
:
77
,
"endColumn"
:
15
,
"suggestions"
:
"111"
},{
"ruleId"
:
"87"
,
"severity"
:
1
,
"message"
:
"112"
,
"line"
:
160
,
"column"
:
9
,
"nodeType"
:
"89"
,
"messageId"
:
"90"
,
"endLine"
:
160
,
"endColumn"
:
13
},{
"ruleId"
:
"113"
,
"severity"
:
1
,
"message"
:
"114"
,
"line"
:
165
,
"column"
:
35
,
"nodeType"
:
"115"
,
"endLine"
:
165
,
"endColumn"
:
76
},
"no-native-reassign"
,[
"116"
],
"no-negated-in-lhs"
,[
"117"
],
"react-hooks/exhaustive-deps"
,
"React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array."
,
"ArrayExpression"
,[
"118"
],
"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."
,[
"119"
],
"'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."
,[
"120"
],
"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array."
,[
"121"
],
"'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"
:
"122"
,
"fix"
:
"123"
},{
"desc"
:
"124"
,
"fix"
:
"125"
},{
"desc"
:
"126"
,
"fix"
:
"127"
},{
"desc"
:
"128"
,
"fix"
:
"129"
},
"Update the dependencies array to be: [getReview]"
,{
"range"
:
"130"
,
"text"
:
"131"
},
"Update the dependencies array to be: [getBookmark]"
,{
"range"
:
"132"
,
"text"
:
"133"
},
"Update the dependencies array to be: [getAssociation]"
,{
"range"
:
"134"
,
"text"
:
"135"
},
"Update the dependencies array to be: [getAssociation, props.history, search, state]"
,{
"range"
:
"136"
,
"text"
:
"137"
},[
665
,
667
],
"[getReview]"
,[
2225
,
2227
],
"[getBookmark]"
,[
2008
,
2010
],
"[getAssociation]"
,[
2917
,
2924
],
"[getAssociation, props.history, search, state]"
]
\ No newline at end of file
\ No newline at end of file
client/src/Pages/App.js
View file @
c368c2c6
...
@@ -61,7 +61,7 @@ function App() {
...
@@ -61,7 +61,7 @@ function App() {
<
/Row
>
<
/Row
>
<
Row
style
=
{{
marginBottom
:
"
5%
"
}}
>
<
Row
style
=
{{
marginBottom
:
"
5%
"
}}
>
<
Form
className
=
"
vw-100
"
onSubmit
=
{
handleSubmit
}
>
<
Form
className
=
"
vw-100
"
onSubmit
=
{
handleSubmit
}
>
<
InputGroup
style
=
{{
width
:
560
}}
>
<
InputGroup
>
<
Form
.
Control
<
Form
.
Control
size
=
"
lg
"
size
=
"
lg
"
placeholder
=
"
검색어를 입력하세요.
"
placeholder
=
"
검색어를 입력하세요.
"
...
...
client/src/Pages/Search.js
View file @
c368c2c6
...
@@ -89,28 +89,6 @@ function Search(props) {
...
@@ -89,28 +89,6 @@ function Search(props) {
}
}
const
places
=
[{
name
:
"
한라산
"
,
address
:
"
제주 서귀포시 토평동 산15-1
"
,
img
:
"
https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg?size=200x200
"
,
},
{
name
:
"
성산일출봉(sungsan)
"
,
address
:
"
제주 서귀포시 성산읍 성산리 1
"
,
img
:
"
https://www.jeju.go.kr/pub/site/geopark/images/sub/sub03/02%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84%EC%9D%B4%EC%95%BC%EA%B8%B0/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84_%EC%84%B1%EC%82%B0%EC%9D%BC%EC%B6%9C%EB%B4%89/1412402261.jpg?400/400
"
,
},
{
name
:
"
해녀의 집(haenyeo)
"
,
address
:
"
제주 서귀포시 성산읍 한도로 141-13지번오조리 3 오조해녀의집
"
,
img
:
"
https://mblogthumb-phinf.pstatic.net/MjAxNjExMTdfMTc0/MDAxNDc5MzU3ODU0ODQy.KZYXCjzsXT3rCsE4HXBfxyCg2buvluBvN_7NxVp7BSwg.loJc89d8JjGXdNCn-4yMd7aMWPjfrZn21TI9Hyzemkog.JPEG.icocam11/20161010_100205.jpg?type=w800
"
,
},
{
name
:
"
오설록 티 뮤지엄(osulloc)
"
,
address
:
"
제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록
"
,
img
:
"
https://cdnweb01.wikitree.co.kr/webdata/editor/202007/01/img_20200701143323_2ced7627.webp
"
,
},
{
name
:
"
오설록 티 뮤지엄(osulloc)
"
,
address
:
"
제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록
"
,
img
:
"
https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg
"
,
}]
if
(
state
!==
false
)
{
if
(
state
!==
false
)
{
// console.log(queryString.parse(props.location.search))
// console.log(queryString.parse(props.location.search))
// = {keyword:search}
// = {keyword:search}
...
@@ -160,7 +138,7 @@ function Search(props) {
...
@@ -160,7 +138,7 @@ function Search(props) {
const
showArr
=
bookmark
const
showArr
=
bookmark
showArr
[
index
]
=
true
showArr
[
index
]
=
true
setBookmark
(
showArr
)
setBookmark
(
showArr
)
console
.
log
(
"
bookmark=
"
,
bookmark
)
console
.
log
(
"
bookmark=
"
,
bookmark
)
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
}
}
...
@@ -215,8 +193,7 @@ function Search(props) {
...
@@ -215,8 +193,7 @@ function Search(props) {
variant
=
{
bookmark
[
index
]
?
"
primary
"
:
"
light
"
}
variant
=
{
bookmark
[
index
]
?
"
primary
"
:
"
light
"
}
onClick
=
{()
=>
handlebookmark
(
index
,
place
)}
>
onClick
=
{()
=>
handlebookmark
(
index
,
place
)}
>
<
Icon
.
BookmarkStarFill
size
=
{
35
}
/
>
<
Icon
.
BookmarkStarFill
size
=
{
35
}
/
>
{
console
.
log
(
"
bookmark
"
,
bookmark
)}
<
/Button> : null
}
{
console
.
log
(
"
bookmark[index]
"
,
bookmark
[
index
])}
<
/Button> : null
}
<
/Card.Title
>
<
/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
>
...
...
server/controllers/place.controller.js
View file @
c368c2c6
import
Places
from
'
../models/Place.js
'
import
Places
from
'
../models/Place.js
'
import
cheerio
from
'
cheerio
'
import
cheerio
from
'
cheerio
'
import
fs
from
'
fs
'
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
nextTick
}
from
'
process
'
;
const
searchPlace
=
async
(
req
,
res
,
next
,)
=>
{
const
searchPlace
=
async
(
req
,
res
,
next
,)
=>
{
...
@@ -23,7 +25,9 @@ const searchPlace = async (req, res, next,) => {
...
@@ -23,7 +25,9 @@ const searchPlace = async (req, res, next,) => {
})
})
req
.
places
=
places
req
.
places
=
places
}
}
next
()
next
()
}
}
const
searchImg
=
async
(
req
,
res
,
next
)
=>
{
const
searchImg
=
async
(
req
,
res
,
next
)
=>
{
...
@@ -46,10 +50,12 @@ const searchImg = async (req, res, next) => {
...
@@ -46,10 +50,12 @@ const searchImg = async (req, res, next) => {
req
.
places
.
times
.
push
(
new
Date
().
toLocaleString
())
req
.
places
.
times
.
push
(
new
Date
().
toLocaleString
())
const
newPlaces
=
await
new
Places
(
req
.
places
).
save
()
const
newPlaces
=
await
new
Places
(
req
.
places
).
save
()
next
()
next
()
})
})
}
else
{
}
else
{
console
.
log
(
"
이미지 생성 오류발생!!
"
)
console
.
log
(
"
이미지 생성 오류발생!!
"
)
}
}
}
}
const
searchAssociation
=
async
(
req
,
res
)
=>
{
const
searchAssociation
=
async
(
req
,
res
)
=>
{
let
Place3
=
req
.
places
.
address
let
Place3
=
req
.
places
.
address
...
@@ -58,7 +64,6 @@ const searchAssociation = async (req, res) => {
...
@@ -58,7 +64,6 @@ const searchAssociation = async (req, res) => {
}
}
else
{
else
{
let
addresse
=
Place3
.
split
(
'
'
)[
0
]
let
addresse
=
Place3
.
split
(
'
'
)[
0
]
let
AssociationsId
=
[]
let
addressPlaces
=
new
RegExp
(
`
${
addresse
}
`
)
let
addressPlaces
=
new
RegExp
(
`
${
addresse
}
`
)
let
responsePlaces
=
await
Places
.
find
({
address
:
addressPlaces
}).
sort
({
updatedAt
:
-
1
})
let
responsePlaces
=
await
Places
.
find
({
address
:
addressPlaces
}).
sort
({
updatedAt
:
-
1
})
res
.
send
(
responsePlaces
)
res
.
send
(
responsePlaces
)
...
@@ -66,4 +71,4 @@ const searchAssociation = async (req, res) => {
...
@@ -66,4 +71,4 @@ const searchAssociation = async (req, res) => {
}
}
export
default
{
searchImg
,
searchPlace
,
searchAssociation
}
export
default
{
searchImg
,
searchPlace
,
searchAssociation
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment