diff --git a/backend/routes/users.js b/backend/routes/users.js index 101a8eead862aeaf4ce315cd690f74366e51bf1f..6553e75a14023de4f9adfcd6117bea055e1647aa 100644 --- a/backend/routes/users.js +++ b/backend/routes/users.js @@ -548,4 +548,35 @@ router.post("/postReply", async function (req, res) { } }); +router.get("/myboard", async function (req, res) { + console.log("/myboard get 호출"); + + try { + let myBoards = await BoardModel.find({ writer: req.session.user.id }); + console.log(myBoards); + + res.send(myBoards); + } catch (err) { + console.log(err); + } +}); + +router.post("/deleteBoard", async function (req, res) { + console.log("/deleteBoard post 호출" + req.body.boardId); + + try { + let deleted = await BoardModel.remove({ _id: req.body.boardId }); + console.log(deleted); + + let myboards = await BoardModel.find({ writer: req.session.user.id }); + console.log(myboards); + + res.send(myboards); + + //res.redirect("http://localhost:3000/myPage"); + } catch (err) { + console.log(err); + } +}); + module.exports = router; diff --git a/frontend/.eslintcache b/frontend/.eslintcache index 44e8fb1326d1288e2908d018a66a9cc77b60e364..a641eb76e4a860b1879f90d1f5608aeee3f9f5ff 100644 --- a/frontend/.eslintcache +++ b/frontend/.eslintcache @@ -1 +1 @@ -[{"C:\\WYH\\frontend\\src\\reportWebVitals.js":"1","C:\\WYH\\frontend\\src\\App.js":"2","C:\\WYH\\frontend\\src\\index.js":"3","C:\\WYH\\frontend\\src\\components\\Profile.js":"4","C:\\WYH\\frontend\\src\\components\\Board.js":"5","C:\\WYH\\frontend\\src\\components\\Home.js":"6","C:\\WYH\\frontend\\src\\components\\Signup.js":"7","C:\\WYH\\frontend\\src\\components\\Login.js":"8","C:\\WYH\\frontend\\src\\components\\WriteBoard.js":"9","C:\\WYH\\frontend\\src\\components\\DetailBoard.js":"10","C:\\WYH\\frontend\\src\\components\\WriteProfile.js":"11"},{"size":362,"mtime":1606157613272,"results":"12","hashOfConfig":"13"},{"size":1764,"mtime":1607415610889,"results":"14","hashOfConfig":"13"},{"size":544,"mtime":1606240034288,"results":"15","hashOfConfig":"13"},{"size":2234,"mtime":1607425040281,"results":"16","hashOfConfig":"13"},{"size":4100,"mtime":1607506999836,"results":"17","hashOfConfig":"13"},{"size":370,"mtime":1606662762631,"results":"18","hashOfConfig":"13"},{"size":1575,"mtime":1607345129868,"results":"19","hashOfConfig":"13"},{"size":1232,"mtime":1606662786263,"results":"20","hashOfConfig":"13"},{"size":3419,"mtime":1607104090152,"results":"21","hashOfConfig":"13"},{"size":4431,"mtime":1607715505644,"results":"22","hashOfConfig":"13"},{"size":3396,"mtime":1607369801073,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"10w9ldj",{"filePath":"27","messages":"28","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"31"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"34","usedDeprecatedRules":"35"},{"filePath":"36","messages":"37","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"38","usedDeprecatedRules":"39"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"42","messages":"43","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"47"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"50","usedDeprecatedRules":"31"},{"filePath":"51","messages":"52","errorCount":0,"warningCount":9,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"53","messages":"54","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"55","usedDeprecatedRules":"31"},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],["56","57"],"C:\\WYH\\frontend\\src\\App.js",["58"],"C:\\WYH\\frontend\\src\\index.js",[],["59","60"],"C:\\WYH\\frontend\\src\\components\\Profile.js",["61","62","63"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { withRouter } from \"react-router-dom\";\r\naxios.defaults.withCredentials = true; // 기존에 해당 설정으로 cors 에러가 나게 한 부분\r\n\r\nconst Profile = ({ match, history }) => {\r\n const { email } = match.params;\r\n const [Profile, setProfile] = useState({\r\n profile_photo: \"\",\r\n created_at: \"\",\r\n self_intro: \"\",\r\n user_id: \"\",\r\n user_email: \"\",\r\n age: \"\",\r\n location: \"\",\r\n });\r\n\r\n const [User, setUser] = useState({\r\n email: \"\",\r\n password: \"\",\r\n name: \"\",\r\n created_at: \"\",\r\n deleted_at: \"\",\r\n });\r\n\r\n const [Img, setImg] = useState(\"\");\r\n\r\n useEffect(async () => {\r\n const fetchData = async () => {\r\n const result = await axios.post(\"http://localhost:3001/profile\", {\r\n email: email,\r\n });\r\n console.dir(result);\r\n setProfile(result.data.p);\r\n setUser(result.data.u);\r\n\r\n setImg(\"http://localhost:3001/uploads/\" + result.data.p.profile_photo);\r\n };\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <>\r\n <h1>{Profile.user_email} 의 프로필화면</h1>\r\n <div>닉네임:{User.name}</div>\r\n <div>자기소게:{Profile.self_intro}</div>\r\n <div>나이:{Profile.age}</div>\r\n <div>사는곳:{Profile.location}</div>\r\n <div>\r\n 프로필사진:<img src={Img} width=\"200px\" height=\"200px\"></img>\r\n </div>\r\n <Link to=\"/board\">메인화면으로 돌아가기</Link>\r\n <button onClick={() => history.goBack()}>뒤로가기</button>\r\n </>\r\n );\r\n};\r\n\r\n// const Profile = (login_info) => {\r\n// const [user, setUser] = useState(\"\");\r\n\r\n// fetch(\"/profile\", {\r\n// method: \"get\",\r\n// headers: {\r\n// \"Content-Type\": \"application/json; charset=utf-8\",\r\n// },\r\n// credentials: \"same-origin\",\r\n// body: JSON.stringify(login_info),\r\n// })\r\n// .then((res) => res.json())\r\n// .then((data) => {\r\n// console.dir(data);\r\n// setUser(data);\r\n// });\r\n\r\n// return (\r\n// <div>\r\n// <h1>{user.username}</h1>\r\n// <h1>{user.nicname}</h1>\r\n// </div>\r\n// );\r\n// };\r\n\r\nexport default withRouter(Profile);\r\n",["64","65"],"C:\\WYH\\frontend\\src\\components\\Board.js",["66","67","68"],"import React, { useEffect, useState } from \"react\";\r\nimport { Route, Link } from \"react-router-dom\";\r\nimport axios from \"axios\";\r\n\r\nconst Board = () => {\r\n const [response, setResponse] = useState([]);\r\n const [input, setInput] = useState(\"\");\r\n const handleInputChange = (e) => {\r\n setInput(e.target.value);\r\n console.log(input);\r\n };\r\n const [choice, setChoice] = useState(\"ex/sp\");\r\n const handleChangeSelect = (e) => {\r\n setChoice(e.target.value);\r\n console.log(choice);\r\n };\r\n\r\n useEffect(async () => {\r\n // try {\r\n // console.log(\"axios 실행\");\r\n // let res = [];\r\n // res = await axios.get(\"http://localhost:3001/board\");\r\n // console.log(res);\r\n // setResponse(res.data);\r\n // console.log(response);\r\n // } catch (err) {\r\n // console.log(\"axios err\");\r\n // console.log(err);\r\n // }\r\n async function fetchData() {\r\n console.log(\"react board get axios 호출\");\r\n const result = await axios.get(\"http://localhost:3001/board\", {\r\n input: input,\r\n });\r\n console.log(result.data);\r\n setResponse(result.data);\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n const handleOnSubmit = () => {\r\n async function fetchData2() {\r\n console.log(\"react board search axios 호출\");\r\n const result2 = await axios.post(\"http://localhost:3001/searchBoard\", {\r\n input: input,\r\n });\r\n console.log(result2.data);\r\n setResponse(result2.data);\r\n }\r\n fetchData2();\r\n };\r\n\r\n const handleOnSubmit2 = () => {\r\n async function fetchData3() {\r\n console.log(\"react board search axios2 호출\");\r\n const result3 = await axios.post(\"http://localhost:3001/searchHobby\", {\r\n hobby: choice,\r\n });\r\n console.log(result3.data);\r\n setResponse(result3.data);\r\n }\r\n fetchData3();\r\n };\r\n\r\n return (\r\n <div>\r\n <button>\r\n <Link to=\"/writeBoard\">게시글 작성</Link>\r\n </button>\r\n <button>\r\n <Link to=\"/updateProf\">프로필 작성</Link>\r\n </button>\r\n\r\n <input\r\n type=\"text\"\r\n //name=\"searchKeyword\"\r\n onChange={handleInputChange}\r\n ></input>\r\n <button type=\"submit\" onClick={handleOnSubmit}>\r\n 게시글검색\r\n </button>\r\n\r\n {/* <form\r\n action=\"http://localhost:3001/searchHobby\"\r\n method=\"post\"\r\n onSubmit={handleOnSubmit2}\r\n > */}\r\n <select name=\"choice\" onChange={handleChangeSelect}>\r\n <option value=\"\" disabled>\r\n 검색할 취미를 선택하세요.\r\n </option>\r\n <option value=\"ex/sp\">운동/스포츠</option>\r\n <option value=\"out/tr\">아웃도어/여행</option>\r\n <option value=\"bk/wr\">인문학/책/글</option>\r\n <option value=\"fg/lg\">외국/언어</option>\r\n <option value=\"cul/pfm\">문화/공연</option>\r\n <option value=\"mu/inst\">음악/악기</option>\r\n <option value=\"cft\">공예/만들기</option>\r\n <option value=\"dan\">댄스/무용</option>\r\n <option value=\"volu\">봉사활동</option>\r\n <option value=\"par\">사교/인맥</option>\r\n <option value=\"game\">게임/오락</option>\r\n <option value=\"pic\">사진/편집/촬영/영상</option>\r\n <option value=\"inv\">제테크/투자</option>\r\n <option value=\"cok/fod\">요리/음식/맛집</option>\r\n <option value=\"fas/bea\">패션/뷰티/코디</option>\r\n <option value=\"art/draw\">미술/그림</option>\r\n </select>\r\n <button type=\"submit\" onClick={handleOnSubmit2}>\r\n 게시글검색\r\n </button>\r\n {/* </form> */}\r\n\r\n <ol>\r\n {response.map((res) => (\r\n <li key={res._id}>\r\n {/* <Link to={`/detailBoard/${res._id}`}>\r\n <div onClick={handleOnClick(res._id)}>\r\n {res.title} {res.created_at}\r\n </div>\r\n </Link> */}\r\n <Link to={`/detailBoard/${res._id}`}>\r\n {res.title} {res.created_at}\r\n </Link>\r\n </li>\r\n ))}\r\n </ol>\r\n </div>\r\n );\r\n};\r\n\r\nexport default Board;\r\n",["69","70"],"C:\\WYH\\frontend\\src\\components\\Home.js",["71"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["72"],"import React, { useState } from \"react\";\r\n//import { post } from \"../../backend/app\";\r\nimport { post } from \"axios\";\r\n\r\nconst Signup = () => {\r\n const [email, setEmail] = useState(\"\");\r\n const [nicname, setNicname] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeEmail = (e) => setEmail(e.target.value);\r\n const onChangeNicname = (e) => setNicname(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/signup\";\r\n // const formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n // formData.append(\"nicname\", nicname);\r\n\r\n // const config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/signup\" method=\"post\">\r\n <h1>회원가입</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={email}\r\n onChange={onChangeEmail}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n 닉네임:\r\n <input\r\n type=\"text\"\r\n name=\"nicname\"\r\n value={nicname}\r\n onChange={onChangeNicname}\r\n ></input>\r\n <button type=\"submit\">가입완료</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Signup;\r\n","C:\\WYH\\frontend\\src\\components\\Login.js",["73"],"import React, { useState } from \"react\";\r\nimport { post } from \"axios\";\r\n\r\nconst Login = () => {\r\n const [username, setUsername] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeUsername = (e) => setUsername(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/login\";\r\n // let formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n\r\n // let config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/login\" method=\"post\">\r\n <h1>로그인 화면</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={username}\r\n onChange={onChangeUsername}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n <button type=\"submit\">로그인</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Login;\r\n","C:\\WYH\\frontend\\src\\components\\WriteBoard.js",["74","75","76","77"],"import React, { useState } from \"react\";\r\n\r\nconst WriteBoard = () => {\r\n const [title, setTitle] = useState(\"\");\r\n const [content, setContent] = useState(\"\");\r\n const [hobby, setHobby] = useState(\"\");\r\n\r\n const onChangeTitle = (e) => setTitle(e.target.value);\r\n const onChangeContent = (e) => setContent(e.target.value);\r\n const onChangeHobby = (e) => setHobby(e.target.value);\r\n\r\n return (\r\n <div>\r\n <form\r\n action=\"http://localhost:3001/writeBoard\"\r\n method=\"post\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>제목</label>\r\n <input type=\"text\" name=\"title\" onChange={onChangeTitle}></input>\r\n <br></br>\r\n <label>본문</label>\r\n <textarea\r\n type=\"text\"\r\n name=\"content\"\r\n onChange={onChangeContent}\r\n ></textarea>\r\n <br></br>\r\n <label>취미</label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"ex/sp\" name=\"hobby\" />\r\n 운동/스포츠\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"out/tr\" name=\"hobby\" />\r\n 아웃도어/여행\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"bk/wr\" name=\"hobby\" />\r\n 인문학/책/글\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fg/lg\" name=\"hobby\" />\r\n 외국/언어\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cul/pfm\" name=\"hobby\" />\r\n 문화/공연\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"mu/inst\" name=\"hobby\" />\r\n 음악/악기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cft\" name=\"hobby\" />\r\n 공예/만들기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"dan\" name=\"hobby\" />\r\n 댄스/무용\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"volu\" name=\"hobby\" />\r\n 봉사활동\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"par\" name=\"hobby\" />\r\n 사교/인맥\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"game\" name=\"hobby\" />\r\n 게임/오락\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"pic\" name=\"hobby\" />\r\n 사진/편집/촬영/영상\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"inv\" name=\"hobby\" />\r\n 제테크/투자\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cok/fod\" name=\"hobby\" />\r\n 요리/음식/맛집\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fas/bea\" name=\"hobby\" />\r\n 패션/뷰티/코디\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"art/draw\" name=\"hobby\" />\r\n 미술/그림\r\n </label>\r\n <br></br>\r\n <br></br>\r\n <label>사진첨부</label>\r\n <input type=\"file\" name=\"photo\"></input>\r\n <br></br>\r\n <button type=\"submit\">ok</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteBoard;\r\n","C:\\WYH\\frontend\\src\\components\\DetailBoard.js",["78","79","80","81","82","83","84","85","86"],"C:\\WYH\\frontend\\src\\components\\WriteProfile.js",["87","88","89","90","91","92"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\n\r\nconst WriteProfile = () => {\r\n const [Profile, setProfile] = useState({\r\n profile_photo: \"\",\r\n created_at: \"\",\r\n self_intro: \"\",\r\n user_id: \"\",\r\n user_email: \"\",\r\n location: \"\",\r\n age: \"\",\r\n });\r\n const [Img, setImg] = useState(\"\");\r\n const [imgBase64, setImgBase64] = useState(\"\");\r\n const [imgFile, setImgFile] = useState(null);\r\n\r\n const handleChangeFile = (event) => {\r\n let reader = new FileReader();\r\n reader.onloadend = () => {\r\n // 2. 읽기가 완료되면 아래코드가 실행됩니다.\r\n const base64 = reader.result;\r\n if (base64) {\r\n setImgBase64(base64.toString()); // 파일 base64 상태 업데이트\r\n }\r\n };\r\n if (event.target.files[0]) {\r\n reader.readAsDataURL(event.target.files[0]); // 1. 파일을 읽어 버퍼에 저장합니다.\r\n setImgFile(event.target.files[0]); // 파일 상태 업데이트\r\n }\r\n };\r\n\r\n const onChangeProfilePhoto = (e) =>\r\n setProfile({ profile_photo: e.target.value });\r\n const onChangeSelfIntro = (e) => setProfile({ self_intro: e.target.value });\r\n const onChangeLocation = (e) => setProfile({ location: e.target.value });\r\n const onChangeAge = (e) => setProfile({ age: e.target.value });\r\n\r\n useEffect(async () => {\r\n async function fetchData() {\r\n console.log(\"writeProfile axios get 호출\");\r\n let res = await axios.get(\"http://localhost:3001/getProfileInfo\");\r\n console.log(res);\r\n console.dir(res.data[0]);\r\n if (res.data[0] != undefined) {\r\n setProfile(res.data[0]);\r\n setImg(\"http://localhost:3001/uploads/\" + res.data[0].profile_photo);\r\n }\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <div>\r\n <label>기존 프로필 사진</label>\r\n <br></br>\r\n <img src={Img} width=\"200px\" height=\"200px\"></img>\r\n <br></br>\r\n <label>선택한 프로필 사진</label>\r\n <br></br>\r\n {/* <div\r\n style={{ backgroundColor: \"#efefef\", width: \"200px\", height: \"200px\" }}\r\n > */}\r\n <img src={imgBase64} width=\"200px\" height=\"200px\" />\r\n {/* </div> */}\r\n <form\r\n method=\"post\"\r\n action=\"http://localhost:3001/writeProfile\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>프로필 사진</label>\r\n <input\r\n type=\"file\"\r\n name=\"photo\"\r\n //value=\"http://localhost:3001/uploads/\"+`{Profile.profile_photo}`\r\n // onChange={onChangeProfilePhoto}\r\n onChange={handleChangeFile}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"self_intro\"\r\n placeholder=\"간단한 자기소개 및 관심사\"\r\n value={Profile.self_intro}\r\n onChange={onChangeSelfIntro}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"age\"\r\n placeholder=\"나이\"\r\n value={Profile.age}\r\n onChange={onChangeAge}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"loc\"\r\n placeholder=\"사는 곳\"\r\n value={Profile.location}\r\n onChange={onChangeLocation}\r\n ></input>\r\n <br></br>\r\n <button type=\"submit\">작성 완료</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteProfile;\r\n",{"ruleId":"93","replacedBy":"94"},{"ruleId":"95","replacedBy":"96"},{"ruleId":"97","severity":1,"message":"98","line":1,"column":17,"nodeType":"99","messageId":"100","endLine":1,"endColumn":26},{"ruleId":"93","replacedBy":"101"},{"ruleId":"95","replacedBy":"102"},{"ruleId":"103","severity":1,"message":"104","line":29,"column":13,"nodeType":"105","endLine":41,"endColumn":4},{"ruleId":"103","severity":1,"message":"106","line":41,"column":6,"nodeType":"107","endLine":41,"endColumn":8,"suggestions":"108"},{"ruleId":"109","severity":1,"message":"110","line":51,"column":15,"nodeType":"111","endLine":51,"endColumn":59},{"ruleId":"93","replacedBy":"112"},{"ruleId":"95","replacedBy":"113"},{"ruleId":"97","severity":1,"message":"114","line":2,"column":10,"nodeType":"99","messageId":"100","endLine":2,"endColumn":15},{"ruleId":"103","severity":1,"message":"104","line":18,"column":13,"nodeType":"105","endLine":39,"endColumn":4},{"ruleId":"103","severity":1,"message":"115","line":39,"column":6,"nodeType":"107","endLine":39,"endColumn":8,"suggestions":"116"},{"ruleId":"93","replacedBy":"117"},{"ruleId":"95","replacedBy":"118"},{"ruleId":"97","severity":1,"message":"114","line":2,"column":10,"nodeType":"99","messageId":"100","endLine":2,"endColumn":15},{"ruleId":"97","severity":1,"message":"119","line":3,"column":10,"nodeType":"99","messageId":"100","endLine":3,"endColumn":14},{"ruleId":"97","severity":1,"message":"119","line":2,"column":10,"nodeType":"99","messageId":"100","endLine":2,"endColumn":14},{"ruleId":"97","severity":1,"message":"120","line":4,"column":10,"nodeType":"99","messageId":"100","endLine":4,"endColumn":15},{"ruleId":"97","severity":1,"message":"121","line":5,"column":10,"nodeType":"99","messageId":"100","endLine":5,"endColumn":17},{"ruleId":"97","severity":1,"message":"122","line":6,"column":10,"nodeType":"99","messageId":"100","endLine":6,"endColumn":15},{"ruleId":"97","severity":1,"message":"123","line":10,"column":9,"nodeType":"99","messageId":"100","endLine":10,"endColumn":22},{"ruleId":"97","severity":1,"message":"124","line":25,"column":10,"nodeType":"99","messageId":"100","endLine":25,"endColumn":15},{"ruleId":"97","severity":1,"message":"125","line":29,"column":9,"nodeType":"99","messageId":"100","endLine":29,"endColumn":22},{"ruleId":"103","severity":1,"message":"104","line":34,"column":13,"nodeType":"105","endLine":60,"endColumn":4},{"ruleId":"126","severity":1,"message":"127","line":47,"column":38,"nodeType":"128","messageId":"129","endLine":47,"endColumn":40},{"ruleId":"103","severity":1,"message":"130","line":60,"column":6,"nodeType":"107","endLine":60,"endColumn":8,"suggestions":"131"},{"ruleId":"97","severity":1,"message":"132","line":62,"column":9,"nodeType":"99","messageId":"100","endLine":62,"endColumn":20},{"ruleId":"109","severity":1,"message":"110","line":84,"column":11,"nodeType":"111","endLine":84,"endColumn":73},{"ruleId":"133","severity":1,"message":"134","line":106,"column":33,"nodeType":"105","messageId":"135","endLine":106,"endColumn":35},{"ruleId":"126","severity":1,"message":"136","line":107,"column":35,"nodeType":"128","messageId":"129","endLine":107,"endColumn":37},{"ruleId":"97","severity":1,"message":"137","line":16,"column":10,"nodeType":"99","messageId":"100","endLine":16,"endColumn":17},{"ruleId":"97","severity":1,"message":"138","line":33,"column":9,"nodeType":"99","messageId":"100","endLine":33,"endColumn":29},{"ruleId":"103","severity":1,"message":"104","line":39,"column":13,"nodeType":"105","endLine":51,"endColumn":4},{"ruleId":"126","severity":1,"message":"127","line":45,"column":23,"nodeType":"128","messageId":"129","endLine":45,"endColumn":25},{"ruleId":"109","severity":1,"message":"110","line":57,"column":7,"nodeType":"111","endLine":57,"endColumn":51},{"ruleId":"109","severity":1,"message":"110","line":64,"column":7,"nodeType":"111","endLine":64,"endColumn":59},"no-native-reassign",["139"],"no-negated-in-lhs",["140"],"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar",["139"],["140"],"react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","React Hook useEffect has a missing dependency: 'email'. Either include it or remove the dependency array.","ArrayExpression",["141"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","JSXOpeningElement",["139"],["140"],"'Route' is defined but never used.","React Hook useEffect has a missing dependency: 'input'. Either include it or remove the dependency array.",["142"],["139"],["140"],"'post' is defined but never used.","'title' is assigned a value but never used.","'content' is assigned a value but never used.","'hobby' is assigned a value but never used.","'onChangeHobby' is assigned a value but never used.","'reply' is assigned a value but never used.","'onChangeReply' is assigned a value but never used.","eqeqeq","Expected '!==' and instead saw '!='.","BinaryExpression","unexpected","React Hook useEffect has missing dependencies: 'Board' and 'board_id'. Either include them or remove the dependency array.",["143"],"'handleReply' is assigned a value but never used.","array-callback-return","Array.prototype.map() expects a value to be returned at the end of arrow function.","expectedAtEnd","Expected '===' and instead saw '=='.","'imgFile' is assigned a value but never used.","'onChangeProfilePhoto' is assigned a value but never used.","no-global-assign","no-unsafe-negation",{"desc":"144","fix":"145"},{"desc":"146","fix":"147"},{"desc":"148","fix":"149"},"Update the dependencies array to be: [email]",{"range":"150","text":"151"},"Update the dependencies array to be: [input]",{"range":"152","text":"153"},"Update the dependencies array to be: [Board, board_id]",{"range":"154","text":"155"},[1071,1073],"[email]",[1141,1143],"[input]",[1732,1734],"[Board, board_id]"] \ No newline at end of file +[{"C:\\WYH\\frontend\\src\\reportWebVitals.js":"1","C:\\WYH\\frontend\\src\\App.js":"2","C:\\WYH\\frontend\\src\\index.js":"3","C:\\WYH\\frontend\\src\\components\\Profile.js":"4","C:\\WYH\\frontend\\src\\components\\Board.js":"5","C:\\WYH\\frontend\\src\\components\\Home.js":"6","C:\\WYH\\frontend\\src\\components\\Signup.js":"7","C:\\WYH\\frontend\\src\\components\\Login.js":"8","C:\\WYH\\frontend\\src\\components\\WriteBoard.js":"9","C:\\WYH\\frontend\\src\\components\\DetailBoard.js":"10","C:\\WYH\\frontend\\src\\components\\WriteProfile.js":"11","C:\\WYH\\frontend\\src\\components\\MyPage.js":"12"},{"size":362,"mtime":1606157613272,"results":"13","hashOfConfig":"14"},{"size":1860,"mtime":1607790328047,"results":"15","hashOfConfig":"14"},{"size":544,"mtime":1606240034288,"results":"16","hashOfConfig":"14"},{"size":2234,"mtime":1607425040281,"results":"17","hashOfConfig":"14"},{"size":4184,"mtime":1607790105796,"results":"18","hashOfConfig":"14"},{"size":370,"mtime":1606662762631,"results":"19","hashOfConfig":"14"},{"size":1575,"mtime":1607345129868,"results":"20","hashOfConfig":"14"},{"size":1232,"mtime":1606662786263,"results":"21","hashOfConfig":"14"},{"size":3419,"mtime":1607104090152,"results":"22","hashOfConfig":"14"},{"size":4431,"mtime":1607715505644,"results":"23","hashOfConfig":"14"},{"size":3396,"mtime":1607369801073,"results":"24","hashOfConfig":"14"},{"size":1147,"mtime":1607793868475,"results":"25","hashOfConfig":"14"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},"10w9ldj",{"filePath":"29","messages":"30","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"33"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"36","usedDeprecatedRules":"33"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"39","usedDeprecatedRules":"33"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"42","messages":"43","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"47"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"50","usedDeprecatedRules":"51"},{"filePath":"52","messages":"53","errorCount":0,"warningCount":9,"fixableErrorCount":0,"fixableWarningCount":0,"source":"54","usedDeprecatedRules":"33"},{"filePath":"55","messages":"56","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"57","usedDeprecatedRules":"51"},{"filePath":"58","messages":"59","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"60","usedDeprecatedRules":"33"},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],["61","62"],"C:\\WYH\\frontend\\src\\App.js",["63"],"C:\\WYH\\frontend\\src\\index.js",[],["64","65"],"C:\\WYH\\frontend\\src\\components\\Profile.js",["66","67","68"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { withRouter } from \"react-router-dom\";\r\naxios.defaults.withCredentials = true; // 기존에 해당 설정으로 cors 에러가 나게 한 부분\r\n\r\nconst Profile = ({ match, history }) => {\r\n const { email } = match.params;\r\n const [Profile, setProfile] = useState({\r\n profile_photo: \"\",\r\n created_at: \"\",\r\n self_intro: \"\",\r\n user_id: \"\",\r\n user_email: \"\",\r\n age: \"\",\r\n location: \"\",\r\n });\r\n\r\n const [User, setUser] = useState({\r\n email: \"\",\r\n password: \"\",\r\n name: \"\",\r\n created_at: \"\",\r\n deleted_at: \"\",\r\n });\r\n\r\n const [Img, setImg] = useState(\"\");\r\n\r\n useEffect(async () => {\r\n const fetchData = async () => {\r\n const result = await axios.post(\"http://localhost:3001/profile\", {\r\n email: email,\r\n });\r\n console.dir(result);\r\n setProfile(result.data.p);\r\n setUser(result.data.u);\r\n\r\n setImg(\"http://localhost:3001/uploads/\" + result.data.p.profile_photo);\r\n };\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <>\r\n <h1>{Profile.user_email} 의 프로필화면</h1>\r\n <div>닉네임:{User.name}</div>\r\n <div>자기소게:{Profile.self_intro}</div>\r\n <div>나이:{Profile.age}</div>\r\n <div>사는곳:{Profile.location}</div>\r\n <div>\r\n 프로필사진:<img src={Img} width=\"200px\" height=\"200px\"></img>\r\n </div>\r\n <Link to=\"/board\">메인화면으로 돌아가기</Link>\r\n <button onClick={() => history.goBack()}>뒤로가기</button>\r\n </>\r\n );\r\n};\r\n\r\n// const Profile = (login_info) => {\r\n// const [user, setUser] = useState(\"\");\r\n\r\n// fetch(\"/profile\", {\r\n// method: \"get\",\r\n// headers: {\r\n// \"Content-Type\": \"application/json; charset=utf-8\",\r\n// },\r\n// credentials: \"same-origin\",\r\n// body: JSON.stringify(login_info),\r\n// })\r\n// .then((res) => res.json())\r\n// .then((data) => {\r\n// console.dir(data);\r\n// setUser(data);\r\n// });\r\n\r\n// return (\r\n// <div>\r\n// <h1>{user.username}</h1>\r\n// <h1>{user.nicname}</h1>\r\n// </div>\r\n// );\r\n// };\r\n\r\nexport default withRouter(Profile);\r\n","C:\\WYH\\frontend\\src\\components\\Board.js",["69","70","71"],"import React, { useEffect, useState } from \"react\";\r\nimport { Route, Link } from \"react-router-dom\";\r\nimport axios from \"axios\";\r\n\r\nconst Board = () => {\r\n const [response, setResponse] = useState([]);\r\n const [input, setInput] = useState(\"\");\r\n const handleInputChange = (e) => {\r\n setInput(e.target.value);\r\n console.log(input);\r\n };\r\n const [choice, setChoice] = useState(\"ex/sp\");\r\n const handleChangeSelect = (e) => {\r\n setChoice(e.target.value);\r\n console.log(choice);\r\n };\r\n\r\n useEffect(async () => {\r\n // try {\r\n // console.log(\"axios 실행\");\r\n // let res = [];\r\n // res = await axios.get(\"http://localhost:3001/board\");\r\n // console.log(res);\r\n // setResponse(res.data);\r\n // console.log(response);\r\n // } catch (err) {\r\n // console.log(\"axios err\");\r\n // console.log(err);\r\n // }\r\n async function fetchData() {\r\n console.log(\"react board get axios 호출\");\r\n const result = await axios.get(\"http://localhost:3001/board\", {\r\n input: input,\r\n });\r\n console.log(result.data);\r\n setResponse(result.data);\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n const handleOnSubmit = () => {\r\n async function fetchData2() {\r\n console.log(\"react board search axios 호출\");\r\n const result2 = await axios.post(\"http://localhost:3001/searchBoard\", {\r\n input: input,\r\n });\r\n console.log(result2.data);\r\n setResponse(result2.data);\r\n }\r\n fetchData2();\r\n };\r\n\r\n const handleOnSubmit2 = () => {\r\n async function fetchData3() {\r\n console.log(\"react board search axios2 호출\");\r\n const result3 = await axios.post(\"http://localhost:3001/searchHobby\", {\r\n hobby: choice,\r\n });\r\n console.log(result3.data);\r\n setResponse(result3.data);\r\n }\r\n fetchData3();\r\n };\r\n\r\n return (\r\n <div>\r\n <button>\r\n <Link to=\"/writeBoard\">게시글 작성</Link>\r\n </button>\r\n <button>\r\n <Link to=\"/updateProf\">프로필 작성</Link>\r\n </button>\r\n\r\n <input\r\n type=\"text\"\r\n //name=\"searchKeyword\"\r\n onChange={handleInputChange}\r\n ></input>\r\n <button type=\"submit\" onClick={handleOnSubmit}>\r\n 게시글검색\r\n </button>\r\n\r\n {/* <form\r\n action=\"http://localhost:3001/searchHobby\"\r\n method=\"post\"\r\n onSubmit={handleOnSubmit2}\r\n > */}\r\n <select name=\"choice\" onChange={handleChangeSelect}>\r\n <option value=\"\" disabled>\r\n 검색할 취미를 선택하세요.\r\n </option>\r\n <option value=\"ex/sp\">운동/스포츠</option>\r\n <option value=\"out/tr\">아웃도어/여행</option>\r\n <option value=\"bk/wr\">인문학/책/글</option>\r\n <option value=\"fg/lg\">외국/언어</option>\r\n <option value=\"cul/pfm\">문화/공연</option>\r\n <option value=\"mu/inst\">음악/악기</option>\r\n <option value=\"cft\">공예/만들기</option>\r\n <option value=\"dan\">댄스/무용</option>\r\n <option value=\"volu\">봉사활동</option>\r\n <option value=\"par\">사교/인맥</option>\r\n <option value=\"game\">게임/오락</option>\r\n <option value=\"pic\">사진/편집/촬영/영상</option>\r\n <option value=\"inv\">제테크/투자</option>\r\n <option value=\"cok/fod\">요리/음식/맛집</option>\r\n <option value=\"fas/bea\">패션/뷰티/코디</option>\r\n <option value=\"art/draw\">미술/그림</option>\r\n </select>\r\n <button type=\"submit\" onClick={handleOnSubmit2}>\r\n 게시글검색\r\n </button>\r\n {/* </form> */}\r\n <button>\r\n <Link to=\"/myPage\">마이페이지</Link>\r\n </button>\r\n\r\n <ol>\r\n {response.map((res) => (\r\n <li key={res._id}>\r\n {/* <Link to={`/detailBoard/${res._id}`}>\r\n <div onClick={handleOnClick(res._id)}>\r\n {res.title} {res.created_at}\r\n </div>\r\n </Link> */}\r\n <Link to={`/detailBoard/${res._id}`}>\r\n {res.title} {res.created_at}\r\n </Link>\r\n </li>\r\n ))}\r\n </ol>\r\n </div>\r\n );\r\n};\r\n\r\nexport default Board;\r\n","C:\\WYH\\frontend\\src\\components\\Home.js",["72"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["73"],"import React, { useState } from \"react\";\r\n//import { post } from \"../../backend/app\";\r\nimport { post } from \"axios\";\r\n\r\nconst Signup = () => {\r\n const [email, setEmail] = useState(\"\");\r\n const [nicname, setNicname] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeEmail = (e) => setEmail(e.target.value);\r\n const onChangeNicname = (e) => setNicname(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/signup\";\r\n // const formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n // formData.append(\"nicname\", nicname);\r\n\r\n // const config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/signup\" method=\"post\">\r\n <h1>회원가입</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={email}\r\n onChange={onChangeEmail}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n 닉네임:\r\n <input\r\n type=\"text\"\r\n name=\"nicname\"\r\n value={nicname}\r\n onChange={onChangeNicname}\r\n ></input>\r\n <button type=\"submit\">가입완료</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Signup;\r\n","C:\\WYH\\frontend\\src\\components\\Login.js",["74"],"import React, { useState } from \"react\";\r\nimport { post } from \"axios\";\r\n\r\nconst Login = () => {\r\n const [username, setUsername] = useState(\"\");\r\n const [password, setPassword] = useState(\"\");\r\n\r\n const onChangeUsername = (e) => setUsername(e.target.value);\r\n const onChangePassword = (e) => setPassword(e.target.value);\r\n\r\n // const handleFormSubmit = () => {\r\n // const url = \"/login\";\r\n // let formData = new FormData();\r\n // formData.append(\"username\", username);\r\n // formData.append(\"password\", password);\r\n\r\n // let config = {\r\n // headers: {\r\n // \"content-type\": \"multipart/form-data\",\r\n // },\r\n // };\r\n\r\n // return post(url, formData, config);\r\n // };\r\n\r\n return (\r\n <form action=\"http://localhost:3001/login\" method=\"post\">\r\n <h1>로그인 화면</h1>\r\n 이메일:\r\n <input\r\n type=\"text\"\r\n name=\"email\"\r\n value={username}\r\n onChange={onChangeUsername}\r\n ></input>\r\n 비밀번호:\r\n <input\r\n type=\"password\"\r\n name=\"password\"\r\n value={password}\r\n onChange={onChangePassword}\r\n ></input>\r\n <button type=\"submit\">로그인</button>\r\n </form>\r\n );\r\n};\r\n\r\nexport default Login;\r\n","C:\\WYH\\frontend\\src\\components\\WriteBoard.js",["75","76","77","78"],"import React, { useState } from \"react\";\r\n\r\nconst WriteBoard = () => {\r\n const [title, setTitle] = useState(\"\");\r\n const [content, setContent] = useState(\"\");\r\n const [hobby, setHobby] = useState(\"\");\r\n\r\n const onChangeTitle = (e) => setTitle(e.target.value);\r\n const onChangeContent = (e) => setContent(e.target.value);\r\n const onChangeHobby = (e) => setHobby(e.target.value);\r\n\r\n return (\r\n <div>\r\n <form\r\n action=\"http://localhost:3001/writeBoard\"\r\n method=\"post\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>제목</label>\r\n <input type=\"text\" name=\"title\" onChange={onChangeTitle}></input>\r\n <br></br>\r\n <label>본문</label>\r\n <textarea\r\n type=\"text\"\r\n name=\"content\"\r\n onChange={onChangeContent}\r\n ></textarea>\r\n <br></br>\r\n <label>취미</label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"ex/sp\" name=\"hobby\" />\r\n 운동/스포츠\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"out/tr\" name=\"hobby\" />\r\n 아웃도어/여행\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"bk/wr\" name=\"hobby\" />\r\n 인문학/책/글\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fg/lg\" name=\"hobby\" />\r\n 외국/언어\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cul/pfm\" name=\"hobby\" />\r\n 문화/공연\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"mu/inst\" name=\"hobby\" />\r\n 음악/악기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cft\" name=\"hobby\" />\r\n 공예/만들기\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"dan\" name=\"hobby\" />\r\n 댄스/무용\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"volu\" name=\"hobby\" />\r\n 봉사활동\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"par\" name=\"hobby\" />\r\n 사교/인맥\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"game\" name=\"hobby\" />\r\n 게임/오락\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"pic\" name=\"hobby\" />\r\n 사진/편집/촬영/영상\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"inv\" name=\"hobby\" />\r\n 제테크/투자\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"cok/fod\" name=\"hobby\" />\r\n 요리/음식/맛집\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"fas/bea\" name=\"hobby\" />\r\n 패션/뷰티/코디\r\n </label>\r\n <br></br>\r\n <label>\r\n <input type=\"radio\" value=\"art/draw\" name=\"hobby\" />\r\n 미술/그림\r\n </label>\r\n <br></br>\r\n <br></br>\r\n <label>사진첨부</label>\r\n <input type=\"file\" name=\"photo\"></input>\r\n <br></br>\r\n <button type=\"submit\">ok</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteBoard;\r\n",["79","80"],"C:\\WYH\\frontend\\src\\components\\DetailBoard.js",["81","82","83","84","85","86","87","88","89"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\nimport { Link } from \"react-router-dom\";\r\n\r\nconst DetailBoard = ({ match }) => {\r\n const { board_id } = match.params;\r\n const [Board, setBoard] = useState({\r\n title: \"\",\r\n content: \"\",\r\n hobby: \"\",\r\n picture: \"\",\r\n writer: \"\",\r\n created_at: \"\",\r\n _id: \"\",\r\n });\r\n // const [Comments, setComments] = useState({\r\n // _id: \"\",\r\n // board_id: \"\",\r\n // writer: \"\",\r\n // input: \"\",\r\n // });\r\n const [Comments, setComments] = useState([]);\r\n const [Imgurl, setImgurl] = useState(\"\");\r\n const [Comment, setComment] = useState(\"\");\r\n const [reply, setReply] = useState(\"\");\r\n const [Replies, setReplies] = useState([]);\r\n\r\n const onChangeComment = (e) => setComment(e.target.value);\r\n const onChangeReply = (e) => setReply(e.target.value);\r\n\r\n console.dir(match.params);\r\n console.log(\"board_id : \" + board_id);\r\n\r\n useEffect(async () => {\r\n async function fetchData() {\r\n console.log(\"react detailBoard axios post 호출1\");\r\n let res = await axios.post(\"http://localhost:3001/getDetailBoard\", {\r\n id: board_id,\r\n });\r\n console.log(\"res : \");\r\n console.dir(res);\r\n setBoard(res.data.detailBoard);\r\n console.log(Board);\r\n setComments(res.data.boardComments);\r\n setReplies(res.data.boardReplies);\r\n if (\r\n res.data.detailBoard.picture != \"\" &&\r\n res.data.detailBoard.picture != null\r\n ) {\r\n console.log(\"이미지있음\");\r\n setImgurl(\r\n \"http://localhost:3001/uploads/\" + res.data.detailBoard.picture\r\n );\r\n } else {\r\n console.log(\"이미지없음\");\r\n setImgurl(\"\");\r\n }\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n const handleReply = async (id) => {\r\n const c_id = id;\r\n async function fetchReplies(cid) {\r\n console.log(\"fetch reply axios 호출\");\r\n const result = await axios.post(\"http://localhost:3001/postReply\");\r\n console.log(result);\r\n setReplies(result);\r\n }\r\n fetchReplies(c_id);\r\n };\r\n\r\n return (\r\n <>\r\n <Link to=\"/board\">홈으로</Link>\r\n <br></br>\r\n <Link to={`/profile/${Board.writer}`}>작성자 : {Board.writer}</Link>\r\n <h3 style={{ width: \"50%\", border: \"1px solid black\" }}>{Board.title}</h3>\r\n <div style={{ width: \"80%\", border: \"1px solid black\" }}>\r\n {Board.content}\r\n </div>\r\n <div>\r\n {Imgurl && (\r\n <img src={Imgurl} style={{ width: \"600px\", height: \"600px\" }}></img>\r\n )}\r\n </div>\r\n <div>\r\n <form method=\"post\" action=\"http://localhost:3001/writeComment\">\r\n <input\r\n type=\"text\"\r\n placeholder=\"댓글을 작성해 주세요.\"\r\n name=\"comment\"\r\n value={Comment}\r\n onChange={onChangeComment}\r\n ></input>\r\n <input type=\"hidden\" name=\"writer\" value={Board.writer}></input>\r\n <input type=\"hidden\" name=\"boardId\" value={Board._id}></input>\r\n <button type=\"submit\">작성완료</button>\r\n </form>\r\n </div>\r\n <div>\r\n <ol>\r\n {Comments.map((c) => (\r\n <li key={c._id}>\r\n {c.input} <Link to={`/profile/${c.writer}`}>{c.writer}</Link>{\" \"}\r\n {Replies.map((re) => {\r\n if (re.comment_id == c._id) {\r\n return (\r\n <div key={re._id}>\r\n - {re.reply_content}{\" \"}\r\n <Link to={`/profile/${re.writer}`}>{re.writer}</Link>\r\n </div>\r\n );\r\n }\r\n })}\r\n <form method=\"post\" action=\"http://localhost:3001/postReply\">\r\n <input type=\"text\" name=\"reply\"></input>\r\n <input type=\"hidden\" name=\"comment_id\" value={c._id}></input>\r\n <input type=\"hidden\" name=\"boardId\" value={Board._id}></input>\r\n <input type=\"hidden\" name=\"writer\"></input>\r\n <button type=\"submit\">답글작성</button>\r\n </form>\r\n {/* <input type=\"text\" value={reply} onChange={onChangeReply}></input>\r\n <input type=\"hidden\" value={c._id}></input>\r\n <button onClick={() => handleReply(c._id)}>답글작성</button> */}\r\n </li>\r\n ))}\r\n </ol>\r\n </div>\r\n </>\r\n );\r\n};\r\n\r\nexport default DetailBoard;\r\n","C:\\WYH\\frontend\\src\\components\\WriteProfile.js",["90","91","92","93","94","95"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\n\r\nconst WriteProfile = () => {\r\n const [Profile, setProfile] = useState({\r\n profile_photo: \"\",\r\n created_at: \"\",\r\n self_intro: \"\",\r\n user_id: \"\",\r\n user_email: \"\",\r\n location: \"\",\r\n age: \"\",\r\n });\r\n const [Img, setImg] = useState(\"\");\r\n const [imgBase64, setImgBase64] = useState(\"\");\r\n const [imgFile, setImgFile] = useState(null);\r\n\r\n const handleChangeFile = (event) => {\r\n let reader = new FileReader();\r\n reader.onloadend = () => {\r\n // 2. 읽기가 완료되면 아래코드가 실행됩니다.\r\n const base64 = reader.result;\r\n if (base64) {\r\n setImgBase64(base64.toString()); // 파일 base64 상태 업데이트\r\n }\r\n };\r\n if (event.target.files[0]) {\r\n reader.readAsDataURL(event.target.files[0]); // 1. 파일을 읽어 버퍼에 저장합니다.\r\n setImgFile(event.target.files[0]); // 파일 상태 업데이트\r\n }\r\n };\r\n\r\n const onChangeProfilePhoto = (e) =>\r\n setProfile({ profile_photo: e.target.value });\r\n const onChangeSelfIntro = (e) => setProfile({ self_intro: e.target.value });\r\n const onChangeLocation = (e) => setProfile({ location: e.target.value });\r\n const onChangeAge = (e) => setProfile({ age: e.target.value });\r\n\r\n useEffect(async () => {\r\n async function fetchData() {\r\n console.log(\"writeProfile axios get 호출\");\r\n let res = await axios.get(\"http://localhost:3001/getProfileInfo\");\r\n console.log(res);\r\n console.dir(res.data[0]);\r\n if (res.data[0] != undefined) {\r\n setProfile(res.data[0]);\r\n setImg(\"http://localhost:3001/uploads/\" + res.data[0].profile_photo);\r\n }\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <div>\r\n <label>기존 프로필 사진</label>\r\n <br></br>\r\n <img src={Img} width=\"200px\" height=\"200px\"></img>\r\n <br></br>\r\n <label>선택한 프로필 사진</label>\r\n <br></br>\r\n {/* <div\r\n style={{ backgroundColor: \"#efefef\", width: \"200px\", height: \"200px\" }}\r\n > */}\r\n <img src={imgBase64} width=\"200px\" height=\"200px\" />\r\n {/* </div> */}\r\n <form\r\n method=\"post\"\r\n action=\"http://localhost:3001/writeProfile\"\r\n encType=\"multipart/form-data\"\r\n >\r\n <label>프로필 사진</label>\r\n <input\r\n type=\"file\"\r\n name=\"photo\"\r\n //value=\"http://localhost:3001/uploads/\"+`{Profile.profile_photo}`\r\n // onChange={onChangeProfilePhoto}\r\n onChange={handleChangeFile}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"self_intro\"\r\n placeholder=\"간단한 자기소개 및 관심사\"\r\n value={Profile.self_intro}\r\n onChange={onChangeSelfIntro}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"age\"\r\n placeholder=\"나이\"\r\n value={Profile.age}\r\n onChange={onChangeAge}\r\n ></input>\r\n <br></br>\r\n <input\r\n type=\"text\"\r\n name=\"loc\"\r\n placeholder=\"사는 곳\"\r\n value={Profile.location}\r\n onChange={onChangeLocation}\r\n ></input>\r\n <br></br>\r\n <button type=\"submit\">작성 완료</button>\r\n </form>\r\n </div>\r\n );\r\n};\r\n\r\nexport default WriteProfile;\r\n","C:\\WYH\\frontend\\src\\components\\MyPage.js",["96"],"import React, { useEffect, useState } from \"react\";\r\nimport axios from \"axios\";\r\nimport { Link } from \"react-router-dom\";\r\n\r\nconst MyPage = () => {\r\n const [Myboards, setMyboards] = useState([]);\r\n\r\n useEffect(async () => {\r\n async function fetchData() {\r\n console.log(\"react myboards get axios 호출\");\r\n const result = await axios.get(\"http://localhost:3001/myboard\");\r\n console.log(result.data);\r\n setMyboards(result.data);\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n const handleDeleteBoard = async (boardId) => {\r\n const result = await axios.post(\"http://localhost:3001/deleteBoard\", {\r\n boardId: boardId,\r\n });\r\n setMyboards(result.data);\r\n };\r\n\r\n return (\r\n <div>\r\n <Link to=\"/board\">홈으로</Link>\r\n <h1>작성한 게시글 목록</h1>\r\n {Myboards.map((myboard) => (\r\n <div key={myboard._id}>\r\n <Link to={`/detailBoard/${myboard._id}`}>\r\n {myboard.title} {myboard.created_at}\r\n </Link>\r\n <button onClick={() => handleDeleteBoard(myboard._id)}>삭제</button>\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n};\r\n\r\nexport default MyPage;\r\n",{"ruleId":"97","replacedBy":"98"},{"ruleId":"99","replacedBy":"100"},{"ruleId":"101","severity":1,"message":"102","line":1,"column":17,"nodeType":"103","messageId":"104","endLine":1,"endColumn":26},{"ruleId":"97","replacedBy":"105"},{"ruleId":"99","replacedBy":"106"},{"ruleId":"107","severity":1,"message":"108","line":29,"column":13,"nodeType":"109","endLine":41,"endColumn":4},{"ruleId":"107","severity":1,"message":"110","line":41,"column":6,"nodeType":"111","endLine":41,"endColumn":8,"suggestions":"112"},{"ruleId":"113","severity":1,"message":"114","line":51,"column":15,"nodeType":"115","endLine":51,"endColumn":59},{"ruleId":"101","severity":1,"message":"116","line":2,"column":10,"nodeType":"103","messageId":"104","endLine":2,"endColumn":15},{"ruleId":"107","severity":1,"message":"108","line":18,"column":13,"nodeType":"109","endLine":39,"endColumn":4},{"ruleId":"107","severity":1,"message":"117","line":39,"column":6,"nodeType":"111","endLine":39,"endColumn":8,"suggestions":"118"},{"ruleId":"101","severity":1,"message":"116","line":2,"column":10,"nodeType":"103","messageId":"104","endLine":2,"endColumn":15},{"ruleId":"101","severity":1,"message":"119","line":3,"column":10,"nodeType":"103","messageId":"104","endLine":3,"endColumn":14},{"ruleId":"101","severity":1,"message":"119","line":2,"column":10,"nodeType":"103","messageId":"104","endLine":2,"endColumn":14},{"ruleId":"101","severity":1,"message":"120","line":4,"column":10,"nodeType":"103","messageId":"104","endLine":4,"endColumn":15},{"ruleId":"101","severity":1,"message":"121","line":5,"column":10,"nodeType":"103","messageId":"104","endLine":5,"endColumn":17},{"ruleId":"101","severity":1,"message":"122","line":6,"column":10,"nodeType":"103","messageId":"104","endLine":6,"endColumn":15},{"ruleId":"101","severity":1,"message":"123","line":10,"column":9,"nodeType":"103","messageId":"104","endLine":10,"endColumn":22},{"ruleId":"97","replacedBy":"124"},{"ruleId":"99","replacedBy":"125"},{"ruleId":"101","severity":1,"message":"126","line":25,"column":10,"nodeType":"103","messageId":"104","endLine":25,"endColumn":15},{"ruleId":"101","severity":1,"message":"127","line":29,"column":9,"nodeType":"103","messageId":"104","endLine":29,"endColumn":22},{"ruleId":"107","severity":1,"message":"108","line":34,"column":13,"nodeType":"109","endLine":60,"endColumn":4},{"ruleId":"128","severity":1,"message":"129","line":47,"column":38,"nodeType":"130","messageId":"131","endLine":47,"endColumn":40},{"ruleId":"107","severity":1,"message":"132","line":60,"column":6,"nodeType":"111","endLine":60,"endColumn":8,"suggestions":"133"},{"ruleId":"101","severity":1,"message":"134","line":62,"column":9,"nodeType":"103","messageId":"104","endLine":62,"endColumn":20},{"ruleId":"113","severity":1,"message":"114","line":84,"column":11,"nodeType":"115","endLine":84,"endColumn":73},{"ruleId":"135","severity":1,"message":"136","line":106,"column":33,"nodeType":"109","messageId":"137","endLine":106,"endColumn":35},{"ruleId":"128","severity":1,"message":"138","line":107,"column":35,"nodeType":"130","messageId":"131","endLine":107,"endColumn":37},{"ruleId":"101","severity":1,"message":"139","line":16,"column":10,"nodeType":"103","messageId":"104","endLine":16,"endColumn":17},{"ruleId":"101","severity":1,"message":"140","line":33,"column":9,"nodeType":"103","messageId":"104","endLine":33,"endColumn":29},{"ruleId":"107","severity":1,"message":"108","line":39,"column":13,"nodeType":"109","endLine":51,"endColumn":4},{"ruleId":"128","severity":1,"message":"129","line":45,"column":23,"nodeType":"130","messageId":"131","endLine":45,"endColumn":25},{"ruleId":"113","severity":1,"message":"114","line":57,"column":7,"nodeType":"115","endLine":57,"endColumn":51},{"ruleId":"113","severity":1,"message":"114","line":64,"column":7,"nodeType":"115","endLine":64,"endColumn":59},{"ruleId":"107","severity":1,"message":"108","line":8,"column":13,"nodeType":"109","endLine":16,"endColumn":4},"no-native-reassign",["141"],"no-negated-in-lhs",["142"],"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar",["141"],["142"],"react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","React Hook useEffect has a missing dependency: 'email'. Either include it or remove the dependency array.","ArrayExpression",["143"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","JSXOpeningElement","'Route' is defined but never used.","React Hook useEffect has a missing dependency: 'input'. Either include it or remove the dependency array.",["144"],"'post' is defined but never used.","'title' is assigned a value but never used.","'content' is assigned a value but never used.","'hobby' is assigned a value but never used.","'onChangeHobby' is assigned a value but never used.",["141"],["142"],"'reply' is assigned a value but never used.","'onChangeReply' is assigned a value but never used.","eqeqeq","Expected '!==' and instead saw '!='.","BinaryExpression","unexpected","React Hook useEffect has missing dependencies: 'Board' and 'board_id'. Either include them or remove the dependency array.",["145"],"'handleReply' is assigned a value but never used.","array-callback-return","Array.prototype.map() expects a value to be returned at the end of arrow function.","expectedAtEnd","Expected '===' and instead saw '=='.","'imgFile' is assigned a value but never used.","'onChangeProfilePhoto' is assigned a value but never used.","no-global-assign","no-unsafe-negation",{"desc":"146","fix":"147"},{"desc":"148","fix":"149"},{"desc":"150","fix":"151"},"Update the dependencies array to be: [email]",{"range":"152","text":"153"},"Update the dependencies array to be: [input]",{"range":"154","text":"155"},"Update the dependencies array to be: [Board, board_id]",{"range":"156","text":"157"},[1071,1073],"[email]",[1141,1143],"[input]",[1732,1734],"[Board, board_id]"] \ No newline at end of file diff --git a/frontend/src/App.js b/frontend/src/App.js index 833b0dd4f3b14938f6c60d330b60a0baf51b6623..883ce8e832ddfede3035a9b64b3393db351fe539 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -8,6 +8,7 @@ import Board from "./components/Board"; import WriteBoard from "./components/WriteBoard"; import DetailBoard from "./components/DetailBoard"; import WriteProfile from "./components/WriteProfile"; +import MyPage from "./components/MyPage"; //class App extends Component { // state = { @@ -44,6 +45,7 @@ const App = () => { <Route path="/board" component={Board} /> <Route path="/writeBoard" component={WriteBoard} exact={true} /> <Route path="/detailBoard/:board_id" component={DetailBoard} /> + <Route path="/myPage" component={MyPage} /> <Route render={({ location }) => ( <div> diff --git a/frontend/src/components/Board.js b/frontend/src/components/Board.js index 02f8e9cbcb904c3261fe3ccd29e978f03e902f6f..3478d7af4ec2db2c4b4a8a66d740346858b95fdc 100644 --- a/frontend/src/components/Board.js +++ b/frontend/src/components/Board.js @@ -110,6 +110,9 @@ const Board = () => { 게시글검색 </button> {/* </form> */} + <button> + <Link to="/myPage">마이페이지</Link> + </button> <ol> {response.map((res) => ( diff --git a/frontend/src/components/MyPage.js b/frontend/src/components/MyPage.js new file mode 100644 index 0000000000000000000000000000000000000000..4c81a1aa939ff0b2d9c44c2cccbba565f7fe6f50 --- /dev/null +++ b/frontend/src/components/MyPage.js @@ -0,0 +1,41 @@ +import React, { useEffect, useState } from "react"; +import axios from "axios"; +import { Link } from "react-router-dom"; + +const MyPage = () => { + const [Myboards, setMyboards] = useState([]); + + useEffect(async () => { + async function fetchData() { + console.log("react myboards get axios 호출"); + const result = await axios.get("http://localhost:3001/myboard"); + console.log(result.data); + setMyboards(result.data); + } + fetchData(); + }, []); + + const handleDeleteBoard = async (boardId) => { + const result = await axios.post("http://localhost:3001/deleteBoard", { + boardId: boardId, + }); + setMyboards(result.data); + }; + + return ( + <div> + <Link to="/board">홈으로</Link> + <h1>작성한 게시글 목록</h1> + {Myboards.map((myboard) => ( + <div key={myboard._id}> + <Link to={`/detailBoard/${myboard._id}`}> + {myboard.title} {myboard.created_at} + </Link> + <button onClick={() => handleDeleteBoard(myboard._id)}>삭제</button> + </div> + ))} + </div> + ); +}; + +export default MyPage;