Skip to content
Snippets Groups Projects
Commit 1d93704f authored by Jaeyong Lee's avatar Jaeyong Lee
Browse files

Resolve Merge

parents e9a7dc82 fc4f3804
No related branches found
No related tags found
No related merge requests found
Showing
with 282 additions and 338 deletions
# compiled output # compiled output
/dist /dist
/node_modules frontend/node_modules
backend/node_modules
# Logs # Logs
logs logs
...@@ -19,7 +20,7 @@ lerna-debug.log* ...@@ -19,7 +20,7 @@ lerna-debug.log*
/.nyc_output /.nyc_output
# production # production
/build front/build
# IDEs and editors # IDEs and editors
/.idea /.idea
......
...@@ -42,7 +42,8 @@ const articleService = { ...@@ -42,7 +42,8 @@ const articleService = {
const agg = const agg =
await Article.aggregate( await Article.aggregate(
[ [
{ "$project": {
"$project":
{ {
"title": 1, "title": 1,
"content": 1, "content": 1,
......
...@@ -31,7 +31,7 @@ router.post('/login', async (req, res) => { ...@@ -31,7 +31,7 @@ router.post('/login', async (req, res) => {
console.log('login done') console.log('login done')
req.session.sessionid = req.body; //프론트에서 건네받은 JWT로 세션 생성 req.session.sessionid = req.body; //프론트에서 건네받은 JWT로 세션 생성
res.cookie('name', JSON.stringify({name:req.body.name, id:req.body.email}), {expires}); //사용자 이름 쿠키 res.cookie('name', JSON.stringify({ name: req.body.name, email: req.body.email, id: req.body.sub }), { expires }); //사용자 이름 쿠키
res.send(req.body.name); // 이름 보내서 뭐하게? res.send(req.body.name); // 이름 보내서 뭐하게?
......
# compiled output
/dist
/node_modules
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# production
/build
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.env
*.local.env
\ No newline at end of file
...@@ -26,16 +26,16 @@ function Article({ data }) { ...@@ -26,16 +26,16 @@ function Article({ data }) {
) )
}); });
const date = DateTime.fromISO(createdAt).toFormat('yyyy년 MM월 dd HH:mm'); const date = DateTime.fromISO(createdAt).toFormat('yyyy-MM-dd HH:mm');
return ( return (
<div className="article" onClick={() => { console.log(_id); MoveTo(`/post/${_id}`) }}> <div className="article" onClick={() => { console.log(_id); MoveTo(`/post/${_id}`) }}>
<p>{keyword}</p>
<h1>{title}</h1> <h1>{title}</h1>
<h2>{keyword}</h2>
<h3>{author.nickname} {date}</h3> <h3>{author.nickname} {date}</h3>
<p>{content}</p> <p>{content}</p>
<p>{listItem}</p> <p>{listItem}</p>
<p>댓글: {comments.length} // 조와요: {likes.length}</p> <p>댓글 {comments.length} | 좋아요 {likes.length}</p>
</div> </div>
); );
} }
......
...@@ -20,7 +20,7 @@ function Comments({data}) { ...@@ -20,7 +20,7 @@ function Comments({data}) {
} }
const articleContext = useContext(ArticleContext); const articleContext = useContext(ArticleContext);
const userinfo = cookie.load('name') const userinfo = cookie.load('name')
const date = DateTime.fromISO(createdAt).toFormat('yyyy년 MM월 dd HH:mm'); const date = DateTime.fromISO(createdAt).toFormat('yyyy-MM-dd HH:mm');
function DeleteComment(e) { function DeleteComment(e) {
const data = { id: _id } const data = { id: _id }
axios axios
...@@ -29,7 +29,6 @@ function Comments({data}) { ...@@ -29,7 +29,6 @@ function Comments({data}) {
headers: { "Content-Type": 'application/json' } headers: { "Content-Type": 'application/json' }
}) })
.then(res => { .then(res => {
alert("The comment is successfully deleted");
return articleContext.requestLoadArticleById(params.id) return articleContext.requestLoadArticleById(params.id)
}) })
.then(res => { .then(res => {
...@@ -40,13 +39,13 @@ function Comments({data}) { ...@@ -40,13 +39,13 @@ function Comments({data}) {
}); });
}; };
if (userinfo.id===author.email) { if (userinfo.id === author.google.id) {
return ( return (
<div class="comment" style={{ display: 'flex' }}> <div class="comment" style={{ display: 'flex' }}>
<p>{author.nickname}</p> <p>{author.nickname}</p>
<p>{content}</p> <p>{content}</p>
<p>{date}</p> <p>{date}</p>
<button style={{height: '30px'}} onClick={DeleteComment} type="submit">지우기</button> <button style={{ width: '30px', height: '30px' }} onClick={DeleteComment} type="submit">X</button>
</div> </div>
); );
} }
......
...@@ -20,7 +20,7 @@ function MapLocator({ loc, keyword }) { ...@@ -20,7 +20,7 @@ function MapLocator({ loc, keyword }) {
center={defaultCenter} center={defaultCenter}
style={{ style={{
// 지도의 크기 // 지도의 크기
width: "300px", width: "450px",
height: "450px" height: "450px"
}} }}
onCreate={setMap} onCreate={setMap}
......
...@@ -4,13 +4,13 @@ import React, { useRef, useState, useEffect, useContext } from 'react'; ...@@ -4,13 +4,13 @@ import React, { useRef, useState, useEffect, useContext } from 'react';
const { kakao } = window; const { kakao } = window;
function SearchMapByKeyword({ loc, setLoc }) { function SearchMapByKeyword({ loc, setLoc }) {
// 아주대학교를 기본 위치로 설정
const [info, setInfo] = useState() const [info, setInfo] = useState()
const [markers, setMarkers] = useState([]) const [markers, setMarkers] = useState([])
const [pagination, setPagination] = useState() const [pagination, setPagination] = useState()
const [map, setMap] = useState() const [map, setMap] = useState()
const [searchKeyword, setSearchKeyword] = useState(); //주소 입력 const [searchKeyword, setSearchKeyword] = useState();
// 아주대학교를 기본 위치로 설정
const defaultCenter = { lat: 37.28238488648025, lng: 127.04350967609274 } const defaultCenter = { lat: 37.28238488648025, lng: 127.04350967609274 }
const ps = new kakao.maps.services.Places() const ps = new kakao.maps.services.Places()
...@@ -21,15 +21,12 @@ function SearchMapByKeyword({ loc, setLoc }) { ...@@ -21,15 +21,12 @@ function SearchMapByKeyword({ loc, setLoc }) {
const handleSearch = () => { const handleSearch = () => {
ps.keywordSearch(searchKeyword, (data, status, _pagination) => { ps.keywordSearch(searchKeyword, (data, status, _pagination) => {
if (status === kakao.maps.services.Status.OK) { if (status === kakao.maps.services.Status.OK) {
// 검색된 장소 위치를 기준으로 지도 범위를 재설정하기위해
// LatLngBounds 객체에 좌표를 추가합니다
const bounds = new kakao.maps.LatLngBounds() const bounds = new kakao.maps.LatLngBounds()
let markers = [] let markers = []
setPagination(_pagination); setPagination(_pagination);
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
// @ts-ignore
markers.push({ markers.push({
position: { position: {
lat: data[i].y, lat: data[i].y,
...@@ -37,14 +34,12 @@ function SearchMapByKeyword({ loc, setLoc }) { ...@@ -37,14 +34,12 @@ function SearchMapByKeyword({ loc, setLoc }) {
}, },
content: data[i].place_name, content: data[i].place_name,
}) })
// @ts-ignore
bounds.extend(new kakao.maps.LatLng(data[i].y, data[i].x)) bounds.extend(new kakao.maps.LatLng(data[i].y, data[i].x))
} }
setMarkers(markers) setMarkers(markers);
// 검색된 장소 위치를 기준으로 지도 범위를 재설정합니다 map.setBounds(bounds);
map.setBounds(bounds)
} }
}, { category_group_code: 'FD6' }) }, { category_group_code: 'FD6' })
} }
...@@ -63,10 +58,7 @@ function SearchMapByKeyword({ loc, setLoc }) { ...@@ -63,10 +58,7 @@ function SearchMapByKeyword({ loc, setLoc }) {
return ( return (
<div className="UserInput"> <div className="UserInput">
<input onChange={handleInput} /> <input onChange={handleInput} />
<button onClick={() => handleSearch()}>검색</button><br></br> <button onClick={() => handleSearch()} style={{ width: '50px' }}>검색</button><br></br>
{/* <input readOnly={true} type="text" placeholder="장소 키워드" value={loc.keyword} />
<input readOnly={true} type="text" placeholder="위도" value={loc.center.lat} />
<input readOnly={true} type="text" placeholder="경도" value={loc.center.lng} /> */}
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Map // 지도를 표시할 Container <Map // 지도를 표시할 Container
center={info && info.position || defaultCenter} center={info && info.position || defaultCenter}
...@@ -82,15 +74,11 @@ function SearchMapByKeyword({ loc, setLoc }) { ...@@ -82,15 +74,11 @@ function SearchMapByKeyword({ loc, setLoc }) {
<MapMarker <MapMarker
key={`marker-${marker.content}-${marker.position.lat},${marker.position.lng}`} key={`marker-${marker.content}-${marker.position.lat},${marker.position.lng}`}
position={marker.position} position={marker.position}
clickable={true} // 마커를 클릭했을 때 지도의 클릭 이벤트가 발생하지 않도록 설정합니다 clickable={true}
// 마커에 마우스오버 이벤트를 등록합니다
onMouseOver={ onMouseOver={
// 마커에 마우스오버 이벤트가 발생하면 인포윈도우를 마커위에 표시합니다
() => setInfo(marker) () => setInfo(marker)
} }
// 마커에 마우스아웃 이벤트를 등록합니다
onMouseOut={ onMouseOut={
// 마커에 마우스아웃 이벤트가 발생하면 인포윈도우를 제거합니다
() => setInfo({ position: marker.position }) () => setInfo({ position: marker.position })
} }
onClick={() => { onClick={() => {
......
.article { .article {
background-color: #ffffff; background-color: #ffffff;
border: 2px solid gray; border: 1px solid gray;
border-radius: 10px;
} }
.article:hover { .article:hover {
......
...@@ -16,16 +16,11 @@ function Login() { ...@@ -16,16 +16,11 @@ function Login() {
const userContext = useContext(UserContext); const userContext = useContext(UserContext);
useEffect(() => {
// console.log(userContext)
});
return ( return (
<div className="App"> <div className="App">
<h1>로그인 '해줘'</h1> <h1>로그인</h1>
<GoogleLoginButton></GoogleLoginButton> <GoogleLoginButton></GoogleLoginButton>
</div>) </div>);
;
} }
export default Login; export default Login;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment