Skip to content
Snippets Groups Projects
Commit 567e471e authored by epson220's avatar epson220
Browse files

get Board detail

parent ea531568
No related branches found
No related tags found
No related merge requests found
[{"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"},{"size":362,"mtime":1606157613272,"results":"11","hashOfConfig":"12"},{"size":1342,"mtime":1607112446370,"results":"13","hashOfConfig":"12"},{"size":544,"mtime":1606240034288,"results":"14","hashOfConfig":"12"},{"size":1175,"mtime":1606662802658,"results":"15","hashOfConfig":"12"},{"size":1622,"mtime":1607166854480,"results":"16","hashOfConfig":"12"},{"size":370,"mtime":1606662762631,"results":"17","hashOfConfig":"12"},{"size":1575,"mtime":1606662809909,"results":"18","hashOfConfig":"12"},{"size":1232,"mtime":1606662786263,"results":"19","hashOfConfig":"12"},{"size":3419,"mtime":1607104090152,"results":"20","hashOfConfig":"12"},{"size":854,"mtime":1607172496657,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"10w9ldj",{"filePath":"24","messages":"25","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33","usedDeprecatedRules":"28"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"36","messages":"37","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"38"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"41"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],"C:\\WYH\\frontend\\src\\App.js",["47"],"C:\\WYH\\frontend\\src\\index.js",[],["48","49"],"C:\\WYH\\frontend\\src\\components\\Profile.js",[],"C:\\WYH\\frontend\\src\\components\\Board.js",["50","51"],"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\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 console.log(result.data);\r\n setResponse(result.data);\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <div>\r\n <button>\r\n <Link to=\"/writeBoard\">게시글 작성</Link>\r\n </button>\r\n <form action=\"http://localhost:3001/searchBoard\" method=\"post\">\r\n <input type=\"text\" name=\"searchKeyword\"></input>\r\n <button type=\"submit\">게시글검색</button>\r\n </form>\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",["52"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["53"],"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",["54"],"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",["55","56","57","58"],"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",["59","60"],{"ruleId":"61","severity":1,"message":"62","line":1,"column":17,"nodeType":"63","messageId":"64","endLine":1,"endColumn":26},{"ruleId":"65","replacedBy":"66"},{"ruleId":"67","replacedBy":"68"},{"ruleId":"61","severity":1,"message":"69","line":2,"column":10,"nodeType":"63","messageId":"64","endLine":2,"endColumn":15},{"ruleId":"70","severity":1,"message":"71","line":8,"column":13,"nodeType":"72","endLine":27,"endColumn":4},{"ruleId":"61","severity":1,"message":"69","line":2,"column":10,"nodeType":"63","messageId":"64","endLine":2,"endColumn":15},{"ruleId":"61","severity":1,"message":"73","line":3,"column":10,"nodeType":"63","messageId":"64","endLine":3,"endColumn":14},{"ruleId":"61","severity":1,"message":"73","line":2,"column":10,"nodeType":"63","messageId":"64","endLine":2,"endColumn":14},{"ruleId":"61","severity":1,"message":"74","line":4,"column":10,"nodeType":"63","messageId":"64","endLine":4,"endColumn":15},{"ruleId":"61","severity":1,"message":"75","line":5,"column":10,"nodeType":"63","messageId":"64","endLine":5,"endColumn":17},{"ruleId":"61","severity":1,"message":"76","line":6,"column":10,"nodeType":"63","messageId":"64","endLine":6,"endColumn":15},{"ruleId":"61","severity":1,"message":"77","line":10,"column":9,"nodeType":"63","messageId":"64","endLine":10,"endColumn":22},{"ruleId":"70","severity":1,"message":"71","line":10,"column":13,"nodeType":"72","endLine":22,"endColumn":4},{"ruleId":"70","severity":1,"message":"78","line":22,"column":6,"nodeType":"79","endLine":22,"endColumn":8,"suggestions":"80"},"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar","no-native-reassign",["81"],"no-negated-in-lhs",["82"],"'Route' is defined but never used.","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","'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.","React Hook useEffect has missing dependencies: 'Board' and 'board_id'. Either include them or remove the dependency array.","ArrayExpression",["83"],"no-global-assign","no-unsafe-negation",{"desc":"84","fix":"85"},"Update the dependencies array to be: [Board, board_id]",{"range":"86","text":"87"},[642,644],"[Board, board_id]"] [{"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"},{"size":362,"mtime":1606157613272,"results":"11","hashOfConfig":"12"},{"size":1342,"mtime":1607184086712,"results":"13","hashOfConfig":"12"},{"size":544,"mtime":1606240034288,"results":"14","hashOfConfig":"12"},{"size":1175,"mtime":1607184077239,"results":"15","hashOfConfig":"12"},{"size":1622,"mtime":1607166854480,"results":"16","hashOfConfig":"12"},{"size":370,"mtime":1606662762631,"results":"17","hashOfConfig":"12"},{"size":1575,"mtime":1606662809909,"results":"18","hashOfConfig":"12"},{"size":1232,"mtime":1606662786263,"results":"19","hashOfConfig":"12"},{"size":3419,"mtime":1607104090152,"results":"20","hashOfConfig":"12"},{"size":1360,"mtime":1607187325157,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"10w9ldj",{"filePath":"24","messages":"25","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33","usedDeprecatedRules":"28"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"36","messages":"37","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"38"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"41"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44","usedDeprecatedRules":"28"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\WYH\\frontend\\src\\reportWebVitals.js",[],"C:\\WYH\\frontend\\src\\App.js",["47"],"C:\\WYH\\frontend\\src\\index.js",[],["48","49"],"C:\\WYH\\frontend\\src\\components\\Profile.js",[],"C:\\WYH\\frontend\\src\\components\\Board.js",["50","51"],"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\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 console.log(result.data);\r\n setResponse(result.data);\r\n }\r\n fetchData();\r\n }, []);\r\n\r\n return (\r\n <div>\r\n <button>\r\n <Link to=\"/writeBoard\">게시글 작성</Link>\r\n </button>\r\n <form action=\"http://localhost:3001/searchBoard\" method=\"post\">\r\n <input type=\"text\" name=\"searchKeyword\"></input>\r\n <button type=\"submit\">게시글검색</button>\r\n </form>\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",["52"],"C:\\WYH\\frontend\\src\\components\\Signup.js",["53"],"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",["54"],"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",["55","56","57","58"],"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",["59","60","61"],{"ruleId":"62","severity":1,"message":"63","line":1,"column":17,"nodeType":"64","messageId":"65","endLine":1,"endColumn":26},{"ruleId":"66","replacedBy":"67"},{"ruleId":"68","replacedBy":"69"},{"ruleId":"62","severity":1,"message":"70","line":2,"column":10,"nodeType":"64","messageId":"65","endLine":2,"endColumn":15},{"ruleId":"71","severity":1,"message":"72","line":8,"column":13,"nodeType":"73","endLine":27,"endColumn":4},{"ruleId":"62","severity":1,"message":"70","line":2,"column":10,"nodeType":"64","messageId":"65","endLine":2,"endColumn":15},{"ruleId":"62","severity":1,"message":"74","line":3,"column":10,"nodeType":"64","messageId":"65","endLine":3,"endColumn":14},{"ruleId":"62","severity":1,"message":"74","line":2,"column":10,"nodeType":"64","messageId":"65","endLine":2,"endColumn":14},{"ruleId":"62","severity":1,"message":"75","line":4,"column":10,"nodeType":"64","messageId":"65","endLine":4,"endColumn":15},{"ruleId":"62","severity":1,"message":"76","line":5,"column":10,"nodeType":"64","messageId":"65","endLine":5,"endColumn":17},{"ruleId":"62","severity":1,"message":"77","line":6,"column":10,"nodeType":"64","messageId":"65","endLine":6,"endColumn":15},{"ruleId":"62","severity":1,"message":"78","line":10,"column":9,"nodeType":"64","messageId":"65","endLine":10,"endColumn":22},{"ruleId":"71","severity":1,"message":"72","line":21,"column":13,"nodeType":"73","endLine":34,"endColumn":4},{"ruleId":"71","severity":1,"message":"79","line":34,"column":6,"nodeType":"80","endLine":34,"endColumn":8,"suggestions":"81"},{"ruleId":"82","severity":1,"message":"83","line":44,"column":9,"nodeType":"84","endLine":44,"endColumn":71},"no-unused-vars","'Component' is defined but never used.","Identifier","unusedVar","no-native-reassign",["85"],"no-negated-in-lhs",["86"],"'Route' is defined but never used.","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","'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.","React Hook useEffect has missing dependencies: 'Board' and 'board_id'. Either include them or remove the dependency array.","ArrayExpression",["87"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","JSXOpeningElement","no-global-assign","no-unsafe-negation",{"desc":"88","fix":"89"},"Update the dependencies array to be: [Board, board_id]",{"range":"90","text":"91"},[926,928],"[Board, board_id]"]
\ No newline at end of file \ No newline at end of file
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import axios from "axios"; import axios from "axios";
import { Link } from "react-router-dom";
const DetailBoard = ({ match }) => { const DetailBoard = ({ match }) => {
const { board_id } = match.params; const { board_id } = match.params;
const [Board, setBoard] = useState([]); const [Board, setBoard] = useState({
title: "",
content: "",
hobby: "",
picture: "",
writer: "",
created_at: "",
_id: "",
});
const [Imgurl, setImgurl] = useState("");
console.dir(match.params); console.dir(match.params);
console.log("board_id : " + board_id); console.log("board_id : " + board_id);
...@@ -17,18 +28,22 @@ const DetailBoard = ({ match }) => { ...@@ -17,18 +28,22 @@ const DetailBoard = ({ match }) => {
console.dir(res); console.dir(res);
setBoard(res.data); setBoard(res.data);
console.log(Board); console.log(Board);
setImgurl("http://localhost:3001/uploads/" + res.data.picture);
} }
fetchData(); fetchData();
}, []); }, []);
return ( return (
<div> <>
{Board.map((b) => ( <Link to="/profile">작성자 : {Board.writer}</Link>
<div> <h3 style={{ width: "50%", border: "1px solid black" }}>{Board.title}</h3>
<div>{b.title}</div> <div>{b.content}</div> <div style={{ width: "80%", border: "1px solid black" }}>
{Board.content}
</div> </div>
))} <div>
<img src={Imgurl} style={{ width: "600px", height: "600px" }}></img>
</div> </div>
</>
); );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment