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

finally

parent 49fe53ff
Branches
No related tags found
No related merge requests found
Pipeline #8484 passed
......@@ -18,16 +18,17 @@ export default function App() {
setCurrentTab(newValue);
}
useEffect(() => {
axios.get('/likes')
.then((response) => {
const data = response.data;
setFavorites(data);
})
.catch((error) => {
console.error('Error:', error);
});
}, []);
// useEffect(() => {
// axios.get('/likes')
// .then((response) => {
// const data = response.data;
// setFavorites(data);
// })
// .catch((error) => {
// console.error('Error:', error);
// });
// }, []);
//수정 - 버전1
// const handleOnLike = (item) => {
// let value = favorites.find(it => it.collectionId == item.collectionId)
......@@ -200,8 +201,7 @@ export default function App() {
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={currentTab} onChange={handleTabChange} aria-label="basic tabs"
centered>
<Tabs value={currentTab} onChange={handleTabChange} aria-label="basic tabs" centered>
<Tab label="Search Music" value={0} />
<Tab label="Favorites" value={1} />
<Tab label="More Contents" value={2} />
......
......@@ -5,18 +5,19 @@ import axios from 'axios';
import React, { useEffect } from 'react';
import App from './App';
const Favorites = ({ list, onLike, setFavorites }) => {
// useEffect(() => {
// axios.get('/likes')
// .then((response) => {
// const data = response.data;
// setFavorites(data);
// })
// .catch((error) => {
// console.error('Error:', error);
// });
// }, []);
const Favorites = ({ list, onLike }) => {
const [Favorites, setFavorites] = React.useState([]);
useEffect(() => {
axios.get('/likes')
.then((response) => {
const data = response.data;
setFavorites(data);
})
.catch((error) => {
console.error('Error:', error);
});
}, []);
return (
<React.Fragment>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment