Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

^^ #75

Merged
merged 3 commits into from
May 13, 2024
Merged

^^ #75

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion back/bookReviewList.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function spoilerFilter(reviewData, spoilerWord) { //리뷰 텍스트, 필터링
let excludedPostIDs = [];
let post_obj = [];

async function bookList(post_id) {
async function bookList(UID,post_id) {
//MYSQL 연결
console.log(post_id);
const mysql = require('mysql2');
Expand Down
5 changes: 3 additions & 2 deletions back/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ app.post('/api/ScrollView', async(req, res) => {
const data =await recommendAlgo.runQueries(UID);
res.json(data);
}else{//post page
console.log(UID);
const data = await reviewListAlgo.bookList(postID);

const data = await reviewListAlgo.bookList(UID,postID);

res.json(data);
}
});
Expand Down
14 changes: 8 additions & 6 deletions front/src/components/PostViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ function PostViewPage() {
.then((data)=>{
console.log("data: ",data);
console.log("url??: ",data.url);
console.log(`{url??}: ${data.url}`);
console.log(`{url??}: ${data.url}`);
const li_ = [];
li_.push(<li>제목: {data.name}</li>);
li_.push(<li>작가: {data.author}</li>);
li_.push(<input type='hidden' name='q' value={data.name}></input>);
li_.push(<li><button onClick={()=>{
(data.url!==null)?
(window.location.href=data.url):
(navigate('/post',{state: {isbn: data.isbn}}));
li_.push(<li><button onClick={()=>{navigate('/post',{state: {isbn: data.isbn}})
}}>같은 책으로 후기 쓰러가기</button></li>);
li_.push(<li><button type="submit" 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
}
}}>책 정보 검색</button></li>);
set_Li(prev_Li=>[...prev_Li,...li_]);
})
.catch(error => console.log(error));
Expand Down Expand Up @@ -131,7 +134,6 @@ function PostViewPage() {
<form action="https://www.google.com/search" method="get" target="_blank">
<ul className={styles.ul}>
{_li}
<li><button type="submit">책 정보 검색</button></li>
</ul>
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions front/src/components/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function SignIn(){
// const credential = GoogleAuthProvider.credentialFromResult(result);
// const token = credential.accessToken;
setUser(result.user);

fetch('/api/signIn',{
method:"POST",
headers: {
Expand Down