Skip to content

Commit

Permalink
๐Ÿงช Test: ๋„๋ฉ”์ธ ์ ์šฉ ํ…Œ์ŠคํŠธ
Browse files Browse the repository at this point in the history
๐Ÿงช Test: ๋„๋ฉ”์ธ ์ ์šฉ ํ…Œ์ŠคํŠธ
  • Loading branch information
Youngbae1126 authored Mar 6, 2024
2 parents b314988 + 9d6c16c commit 10e502c
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 321 deletions.
16 changes: 11 additions & 5 deletions src/components/BookDetailCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import HashTag from '../components/HashTag';
//STYLES
import '../styles/BookDetailCard.css';

const BookDetailCard = ({ title, author }) => {
const BookDetailCard = ({ title, author, imageUrl }) => {
const [searchParams, setSearchParams] = useSearchParams();
const bookTitle = searchParams.get('title');
// console.log('title:', bookTitle);
Expand All @@ -22,20 +22,26 @@ const BookDetailCard = ({ title, author }) => {
<div className="bookCard_container">
<div className="bookCard_wrapper">
<div className="bookCard_left_wrapper">
<div className="left_img_wrapper"></div>
<div className="left_img_wrapper">
<img
className="img_wrapper_thumbnail"
src={imageUrl}
alt="์ธ๋„ค์ผ"
/>
</div>
</div>
<div className="bookCard_right_wrapper">
<div className="bookCard_right_up_wrapper">
<div className="right_up_title">{title}</div>
<div className="right_up_title" title={title}>
{title}
</div>
<div className="right_up_author">{author}</div>
</div>
<div className="bookCard_right_bottom_wrapper">
<HashTag text={'ํ–‰๋ณต'} type="sm-category" />
<HashTag text={'ํ•ดํ”ผ๋‹ˆ์Šค'} type="sm-category" />
<HashTag text={'ํด๋กœ๋ฒ„'} type="sm-category" />
<HashTag text={'ํ•ด์‰ฌํƒœ๊ทธ4'} type="sm-category" />
<HashTag text={'ํ•ด์‰ฌํƒœ๊ทธ5'} type="sm-category" />
<HashTag text={'ํ•ด์‰ฌ6'} type="sm-category" />
</div>
</div>
</div>
Expand Down
40 changes: 12 additions & 28 deletions src/pages/BookList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,33 +150,18 @@ const BookList = () => {

// ์ค‘๋ถ„๋ฅ˜ ๊ฐ€์ ธ์˜ค๊ธฐ

categories.map((res) => {
console.log('๋Œ€๋ถ„๋ฅ˜:', title);
setMidCategory(res[title]);
});
// axios
// .get(
// 'https://port-0-backend-book-pharmacy-umnqdut2blqqhv7sd.sel5.cloudtype.app/api/category/big',
// )
// .then((res) => {
// setMidCategory(res.data);
// console.log(res.data);
// console.log('๋Œ€๋ถ„๋ฅ˜:', title);
// setMidCategory(res.data[title]);
// categories.map((result) => {
// console.log(result);
// if (result.big === title) {
// console.log(result.big);
// console.log(result.mid);
// setMidCategory(result.mid);
// setNameList(result.big);
// console.log('name:', nameList);
// }
// console.log('yes');
// });

// console.log(res.data[title]);
// categories.map((res) => {
// console.log('๋Œ€๋ถ„๋ฅ˜:', title);
// setMidCategory(res[title]);
// });
axios
.get(
'https://port-0-backend-book-pharmacy-umnqdut2blqqhv7sd.sel5.cloudtype.app/api/category/big',
)
.then((res) => {
console.log(res.data[title]);
setMidCategory(res.data[title]);
});
}, []);

return (
Expand All @@ -192,9 +177,8 @@ const BookList = () => {
/>
<div className="bookList_wrapper">
{midCategory?.map((e) => {
console.log(e);
// console.log(e);
// setNameList(e.name);
// key ๊ฐ’ ์ค‘๋ถ„๋ฅ˜์— ๋งž๊ฒŒ ๋ณ€๊ฒฝํ•ด์•ผ๋จ.
return (
<BookListSlide
key={e}
Expand Down
34 changes: 7 additions & 27 deletions src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,38 +116,18 @@ export default function Login() {
const loginData = { username: id, password: pwd };

const postLogin = async () => {
console.log('์•„์ด๋””:', id, '๋น„๋ฒˆ:', pwd);
// console.log('์•„์ด๋””:', id, '๋น„๋ฒˆ:', pwd);
setUserId(id);
setUserPwd(pwd);
if (id.length > 0 && pwd.length > 0) {
localStorage.setItem('id', id);
localStorage.setItem('password', pwd);
axios
.post(
'https://port-0-backend-book-pharmacy-umnqdut2blqqhv7sd.sel5.cloudtype.app/login',
loginData,
{ withCredentials: true },
)
.then(() => {
axios
.get(
'https://port-0-backend-book-pharmacy-umnqdut2blqqhv7sd.sel5.cloudtype.app/hello',
{ withCredentials: true },
)
.then((res) => {
console.log(res.data);
})
.catch((err) => {
console.log(err);
});
.post('https://api.bookpharmacy.store/login', loginData, {
withCredentials: true,
})
.then((res) => {
// console.log(res);
// let token = res.headers.authorization;
// // localStorage.setItem('token', token); // ์ „์ฒด ํ† ํฐ ์ €์žฅ
// localStorage.setItem('accessToken', 'Bearer ' + token.split(' ')[1]); // ์•ก์„ธ์Šค ํ† ํฐ ์ €์žฅ

// localStorage.setItem('refreshToken', 'Bearer ' + token.split(' ')[2]); // ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์ €์žฅ

// ๋ฐ›์•„์˜จ token์„ ์•”ํ˜ธํ™” ํ•˜๋Š” ๋ฐฉ์‹์— ๋Œ€ํ•ด ๊ณ ๋ฏผ ํ•„์š”ํ•จ.
localStorage.setItem('id', id);
localStorage.setItem('password', pwd);

// window.location.replace('/main');
})
Expand Down
Loading

0 comments on commit 10e502c

Please sign in to comment.