Skip to content
Snippets Groups Projects
Commit fc4f3804 authored by Gwangbin's avatar Gwangbin
Browse files

Fix: code beautify

parent c20349e0
Branches
No related tags found
No related merge requests found
Showing
with 282 additions and 338 deletions
# compiled output
/dist
/node_modules
frontend/node_modules
backend/node_modules
# Logs
logs
......@@ -19,7 +20,7 @@ lerna-debug.log*
/.nyc_output
# production
/build
front/build
# IDEs and editors
/.idea
......
......@@ -42,7 +42,8 @@ const articleService = {
const agg =
await Article.aggregate(
[
{ "$project":
{
"$project":
{
"title": 1,
"content": 1,
......
......@@ -31,7 +31,7 @@ router.post('/login', async (req, res) => {
console.log('login done')
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); // 이름 보내서 뭐하게?
......
# 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 }) {
)
});
const date = DateTime.fromISO(createdAt).toFormat('yyyy년 MM월 dd HH:mm');
const date = DateTime.fromISO(createdAt).toFormat('yyyy-MM-dd HH:mm');
return (
<div className="article" onClick={() => { console.log(_id); MoveTo(`/post/${_id}`) }}>
<p>{keyword}</p>
<h1>{title}</h1>
<h2>{keyword}</h2>
<h3>{author.nickname} {date}</h3>
<p>{content}</p>
<p>{listItem}</p>
<p>댓글: {comments.length} // 조와요: {likes.length}</p>
<p>댓글 {comments.length} | 좋아요 {likes.length}</p>
</div>
);
}
......
......@@ -20,7 +20,7 @@ function Comments({data}) {
}
const articleContext = useContext(ArticleContext);
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) {
const data = { id: _id }
axios
......@@ -29,7 +29,6 @@ function Comments({data}) {
headers: { "Content-Type": 'application/json' }
})
.then(res => {
alert("The comment is successfully deleted");
return articleContext.requestLoadArticleById(params.id)
})
.then(res => {
......@@ -40,13 +39,13 @@ function Comments({data}) {
});
};
if (userinfo.id===author.email) {
if (userinfo.id === author.google.id) {
return (
<div class="comment" style={{ display: 'flex' }}>
<p>{author.nickname}</p>
<p>{content}</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>
);
}
......
......@@ -20,7 +20,7 @@ function MapLocator({ loc, keyword }) {
center={defaultCenter}
style={{
// 지도의 크기
width: "300px",
width: "450px",
height: "450px"
}}
onCreate={setMap}
......
......@@ -4,13 +4,13 @@ import React, { useRef, useState, useEffect, useContext } from 'react';
const { kakao } = window;
function SearchMapByKeyword({ loc, setLoc }) {
// 아주대학교를 기본 위치로 설정
const [info, setInfo] = useState()
const [markers, setMarkers] = useState([])
const [pagination, setPagination] = useState()
const [map, setMap] = useState()
const [searchKeyword, setSearchKeyword] = useState(); //주소 입력
const [searchKeyword, setSearchKeyword] = useState();
// 아주대학교를 기본 위치로 설정
const defaultCenter = { lat: 37.28238488648025, lng: 127.04350967609274 }
const ps = new kakao.maps.services.Places()
......@@ -21,15 +21,12 @@ function SearchMapByKeyword({ loc, setLoc }) {
const handleSearch = () => {
ps.keywordSearch(searchKeyword, (data, status, _pagination) => {
if (status === kakao.maps.services.Status.OK) {
// 검색된 장소 위치를 기준으로 지도 범위를 재설정하기위해
// LatLngBounds 객체에 좌표를 추가합니다
const bounds = new kakao.maps.LatLngBounds()
let markers = []
setPagination(_pagination);
for (var i = 0; i < data.length; i++) {
// @ts-ignore
markers.push({
position: {
lat: data[i].y,
......@@ -37,14 +34,12 @@ function SearchMapByKeyword({ loc, setLoc }) {
},
content: data[i].place_name,
})
// @ts-ignore
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' })
}
......@@ -63,10 +58,7 @@ function SearchMapByKeyword({ loc, setLoc }) {
return (
<div className="UserInput">
<input onChange={handleInput} />
<button onClick={() => handleSearch()}>검색</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} /> */}
<button onClick={() => handleSearch()} style={{ width: '50px' }}>검색</button><br></br>
<div style={{ display: 'flex' }}>
<Map // 지도를 표시할 Container
center={info && info.position || defaultCenter}
......@@ -82,15 +74,11 @@ function SearchMapByKeyword({ loc, setLoc }) {
<MapMarker
key={`marker-${marker.content}-${marker.position.lat},${marker.position.lng}`}
position={marker.position}
clickable={true} // 마커를 클릭했을 때 지도의 클릭 이벤트가 발생하지 않도록 설정합니다
// 마커에 마우스오버 이벤트를 등록합니다
clickable={true}
onMouseOver={
// 마커에 마우스오버 이벤트가 발생하면 인포윈도우를 마커위에 표시합니다
() => setInfo(marker)
}
// 마커에 마우스아웃 이벤트를 등록합니다
onMouseOut={
// 마커에 마우스아웃 이벤트가 발생하면 인포윈도우를 제거합니다
() => setInfo({ position: marker.position })
}
onClick={() => {
......
.article {
background-color: #ffffff;
border: 2px solid gray;
border: 1px solid gray;
border-radius: 10px;
}
.article:hover {
......
......@@ -16,16 +16,11 @@ function Login() {
const userContext = useContext(UserContext);
useEffect(() => {
// console.log(userContext)
});
return (
<div className="App">
<h1>로그인 '해줘'</h1>
<h1>로그인</h1>
<GoogleLoginButton></GoogleLoginButton>
</div>)
;
</div>);
}
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