Skip to content
Snippets Groups Projects
Commit 68de4d38 authored by nahyun's avatar nahyun
Browse files

i don't know, so hard, null...

parent 601be829
Branches
No related tags found
No related merge requests found
Pipeline #8421 passed
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"@emotion/react": "^11.9.3", "@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3", "@emotion/styled": "^11.9.3",
"@mui/icons-material": "^5.14.0", "@mui/icons-material": "^5.14.0",
"@mui/material": "^5.8.6" "@mui/material": "^5.8.6",
"axios": "^1.4.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.18.6", "@babel/cli": "^7.18.6",
...@@ -2879,6 +2880,21 @@ ...@@ -2879,6 +2880,21 @@
"integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==",
"dev": true "dev": true
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/babel-loader": { "node_modules/babel-loader": {
"version": "8.3.0", "version": "8.3.0",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.3.0.tgz", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.3.0.tgz",
...@@ -3273,6 +3289,17 @@ ...@@ -3273,6 +3289,17 @@
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
...@@ -3486,6 +3513,14 @@ ...@@ -3486,6 +3513,14 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/depd": { "node_modules/depd": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
...@@ -3936,7 +3971,6 @@ ...@@ -3936,7 +3971,6 @@
"version": "1.15.2", "version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"dev": true,
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
...@@ -3952,6 +3986,19 @@ ...@@ -3952,6 +3986,19 @@
} }
} }
}, },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/forwarded": { "node_modules/forwarded": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
...@@ -4760,7 +4807,6 @@ ...@@ -4760,7 +4807,6 @@
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
} }
...@@ -4769,7 +4815,6 @@ ...@@ -4769,7 +4815,6 @@
"version": "2.1.35", "version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"dependencies": { "dependencies": {
"mime-db": "1.52.0" "mime-db": "1.52.0"
}, },
...@@ -5173,6 +5218,11 @@ ...@@ -5173,6 +5218,11 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"@emotion/react": "^11.9.3", "@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3", "@emotion/styled": "^11.9.3",
"@mui/icons-material": "^5.14.0", "@mui/icons-material": "^5.14.0",
"@mui/material": "^5.8.6" "@mui/material": "^5.8.6",
"axios": "^1.4.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.18.6", "@babel/cli": "^7.18.6",
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -4,6 +4,7 @@ import music_list from './data'; ...@@ -4,6 +4,7 @@ import music_list from './data';
import { Box, Tabs, Tab, Typography, AppBar, CssBaseline } from '@mui/material'; import { Box, Tabs, Tab, Typography, AppBar, CssBaseline } from '@mui/material';
import SearchPage from './SearchPage'; import SearchPage from './SearchPage';
import Favorites from './favorites'; import Favorites from './favorites';
import axios from 'axios';
export default function App() { export default function App() {
const [currentTab, setCurrentTab] = React.useState(0); const [currentTab, setCurrentTab] = React.useState(0);
...@@ -55,6 +56,18 @@ export default function App() { ...@@ -55,6 +56,18 @@ export default function App() {
setFavorites([...favorites, item]); setFavorites([...favorites, item]);
//setFavorites([...favorites, { ...item, like: true }]); //setFavorites([...favorites, { ...item, like: true }]);
//좋아요 아이템 spring 서버로 보내기
axios.post('/likes', { collectionId: item.collectionId },
{ collectionType: item.collectionType },
{ artistId: item.artistId }
)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error('Error:', error);
});
} }
// const updatedSearchResult = searchResult.map((it) => // const updatedSearchResult = searchResult.map((it) =>
......
...@@ -45,7 +45,7 @@ export default function MusicList({ list, onLike }) { ...@@ -45,7 +45,7 @@ export default function MusicList({ list, onLike }) {
return ( return (
<div> <div>
{list.map(item => { {list && list.map(item => {
return ( return (
<Card sx={styles.card} key={item.collectionId}> <Card sx={styles.card} key={item.collectionId}>
<CardContent> <CardContent>
......
import React from 'react'; import React from 'react';
import { Button, TextField } from '@mui/material'; import { Button, TextField } from '@mui/material';
import MusicList from './MusicList'; import MusicList from './MusicList';
import axios from 'axios';
export default function SearchPage({ list, onSearch, onLike }) { export default function SearchPage({ list, onSearch, onLike }) {
const [searchWord, setSearchWord] = React.useState(''); const [searchWord, setSearchWord] = React.useState('');
...@@ -9,17 +10,39 @@ export default function SearchPage({ list, onSearch, onLike }) { ...@@ -9,17 +10,39 @@ export default function SearchPage({ list, onSearch, onLike }) {
event.preventDefault(); event.preventDefault();
console.log(searchWord); console.log(searchWord);
setSearchWord(''); setSearchWord('');
fetch(`http://itunes.apple.com/search?term=${searchWord}&entity=album`) // fetch(`http://itunes.apple.com/search?term=${searchWord}&entity=album`)
// .then(r => r.json()).then(r => {
// console.log(r);
// // const updatedList = r.results.map(item => ({
// // ...item,
// // show: true,
// // liked: false
// // }));
// onSearch(r.results);
// setSearchWord('');
// }).catch(e => console.log('error when search musician'))
// axios.get(`/musicSearch/${searchWord}`)
// .then((response) => {
// const data = response.data;
// console.log(data);
// onSearch(data);
// })
// .catch((error) => {
// console.error('Error:', error);
// });
fetch(`/musicSearch/${encodeURIComponent(searchWord)}`, {
method: 'GET', // HTTP 메서드는 GET입니다.
headers: {},
})
.then(r => r.json()).then(r => { .then(r => r.json()).then(r => {
console.log(r); console.log(r);
// const updatedList = r.results.map(item => ({
// ...item,
// show: true,
// liked: false
// }));
onSearch(r.results); onSearch(r.results);
setSearchWord(''); setSearchWord('');
}).catch(e => console.log('error when search musician')) }).catch(e => console.log('error when search musician'))
} }
const handleSearchTextChange = (event) => { const handleSearchTextChange = (event) => {
......
...@@ -12,3 +12,35 @@ const Favorites = ({ list, onLike }) => { ...@@ -12,3 +12,35 @@ const Favorites = ({ list, onLike }) => {
}; };
export default Favorites; export default Favorites;
// import React from 'react';
// import MusicList from './MusicList';
// import axios from 'axios';
// export default function Favorites() {
// const { favorites, handleOnLike } = useContext(LikeContext); // Context에서 favorites와 handleOnLike 함수 가져오기
// const [favoriteList, setFavoriteList] = useState([]); // 즐겨찾기 목록 상태 정의
// useEffect(() => {
// // /likes endpoint를 사용하여 즐겨찾기 목록을 가져옵니다.
// axios.get('/likes')
// .then((response) => {
// setFavoriteList(response.data);
// })
// .catch((error) => {
// console.error('Error:', error);
// });
// }, []); // 빈 배열을 전달하여 처음에만 실행되도록 설정합니다.
// // MusicList 컴포넌트에 즐겨찾기 정보를 전달하도록 설정합니다.
// const musicListWithFavorites = favorites.map((item) => ({
// ...item,
// like: true,
// }));
// return (
// <React.Fragment>
// <MusicList list={musicListWithFavorites} onLike={handleOnLike} />
// </React.Fragment>
// );
// }
...@@ -7,7 +7,7 @@ module.exports = { ...@@ -7,7 +7,7 @@ module.exports = {
}, },
output: { output: {
filename: '[name].bundle.js', filename: '[name].bundle.js',
path: path.resolve(__dirname, 'public') path: path.resolve(__dirname, '/home/nhle0217/springweb/src/main/resources/public')
}, },
module: { module: {
rules: [{ rules: [{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment