Skip to content

Commit

Permalink
Merge pull request #86 from obb8923/master
Browse files Browse the repository at this point in the history
filter
  • Loading branch information
obb8923 authored May 19, 2024
2 parents 56a5073 + 524c6a5 commit 4c5fae9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 6 additions & 2 deletions back/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ app.post('/api/post/:postId',(req,res)=>{
}
})
}

//스포일러 필터링X 리뷰 result[0], 스포일러 필터링된 리뷰 result[1]
result.push(result[0]);
let a = result[0].name;
Expand All @@ -154,6 +155,7 @@ app.post('/api/post/:postId',(req,res)=>{
let body = [];
body.push(results[0].body);
result[1].body = spoilerFilter.spoilerFilter(body, spoilerWord)[0];

res.json(result);
});
});
Expand All @@ -178,9 +180,11 @@ app.get('/api/books/search/:identifier', (req, res) => {

//filter정보 받아오기
app.post('/api/filter', (req, res) => {
const {literature,history,science,art,language,philosophy}= req.body;
const {literature,nonFiction} = req.body;
//const {literature,history,science,art,language,philosophy}= req.body;
const UID = req.body.UID;
const filter = [literature,history,science,art,language,philosophy];
const filter = [literature,nonFiction];
//const filter = [literature,history,science,art,language,philosophy];
const filter_db = filter.map(value=>value?1:0).join("");
console.log('Received filter:', req.body);
console.log('filter_db: ',filter_db);
Expand Down
16 changes: 9 additions & 7 deletions front/src/components/NavButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ function NavButton(props) {
// 체크박스 상태
const [checkboxStates, setCheckboxStates] = useState({
literature: false,
history: false,
science: false,
art: false,
language: false,
philosophy: false,
nonFiction:false,
// history: false,
// science: false,
// art: false,
// language: false,
// philosophy: false,
UID:UID
});

Expand Down Expand Up @@ -145,11 +146,12 @@ function NavButton(props) {
<form name="filter" onSubmit={handleSubmit}>
{/* 총류 / 철학,심리학,윤리학 / 종교 / 사회과학 / 자연과학 / 기술과학 / 예술 / 언어 / 역사 / 문학 */}
<label><input name="literature" type="checkbox" checked={checkboxStates.literature} onChange={handleCheckboxChange} />문학</label>
<label><input name="history" type="checkbox" checked={checkboxStates.history} onChange={handleCheckboxChange} />역사, 사회과학</label>
<label><input name="nonFiction" type="checkbox" checked={checkboxStates.nonFiction} onChange={handleCheckboxChange} />비문학</label>
{/* <label><input name="history" type="checkbox" checked={checkboxStates.history} onChange={handleCheckboxChange} />역사, 사회과학</label>
<label><input name="science" type="checkbox" checked={checkboxStates.science} onChange={handleCheckboxChange} />기술, 자연과학</label>
<label><input name="art" type="checkbox" checked={checkboxStates.art} onChange={handleCheckboxChange} />예술</label>
<label><input name="language" type="checkbox" checked={checkboxStates.language} onChange={handleCheckboxChange} />언어</label>
<label><input name="philosophy" type="checkbox" checked={checkboxStates.philosophy} onChange={handleCheckboxChange} />철학,심리,윤리</label>
<label><input name="philosophy" type="checkbox" checked={checkboxStates.philosophy} onChange={handleCheckboxChange} />철학,심리,윤리</label> */}
<input type="submit" value="확인"/>
</form>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/PostViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function PostViewPage() {
}
}} /></li>);

li_.push(<li key="search"><input type="submit" value="책 정보 검색" onClick={(e) => {
li_.push(<li key="search"><input type="submit" value="책 정보 검색하기" onClick={(e) => {
if (data.url !== null) {// when url is null
e.preventDefault();// prevent submit
window.open(data.url, '_blank');//open url in a new tab
Expand Down

0 comments on commit 4c5fae9

Please sign in to comment.