Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
react-material
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nahyun
react-material
Commits
fa4776e6
Commit
fa4776e6
authored
1 year ago
by
nahyun
Browse files
Options
Downloads
Patches
Plain Diff
새로고침 오류 정정
parent
e3b5ea60
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#8505
passed
1 year ago
Stage: deploy
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/App.js
+18
-3
18 additions, 3 deletions
src/App.js
src/MusicList.js
+1
-1
1 addition, 1 deletion
src/MusicList.js
src/SearchPage.js
+1
-1
1 addition, 1 deletion
src/SearchPage.js
src/favorites.js
+1
-0
1 addition, 0 deletions
src/favorites.js
with
21 additions
and
5 deletions
src/App.js
+
18
−
3
View file @
fa4776e6
...
@@ -271,8 +271,24 @@ export default function App() {
...
@@ -271,8 +271,24 @@ export default function App() {
// .catch(e => console.log('error when post >', e));
// .catch(e => console.log('error when post >', e));
// }
// }
React
.
useEffect
(()
=>
{
const
getLikesData
=
async
()
=>
{
try
{
const
res
=
await
axios
.
get
(
"
http://localhost:8888/likes
"
);
const
temp
=
res
.
data
.
map
((
item
)
=>
({
...
item
,
like
:
true
}));
setFavorites
(
temp
);
//setFavorites(res.data);
}
catch
(
e
)
{
console
.
log
(
e
);
}
};
getLikesData
();
},
[]);
const
handleOnlike
=
(
item
)
=>
{
const
handleOnlike
=
(
item
)
=>
{
let
t
=
favorite
Item
.
find
(
it
=>
it
.
collectionId
==
item
.
collectionId
)
let
t
=
favorite
s
.
find
(
it
=>
it
.
collectionId
==
item
.
collectionId
)
if
(
t
)
{
if
(
t
)
{
fetch
(
`/likes/
${
item
.
collectionId
}
`
,
{
fetch
(
`/likes/
${
item
.
collectionId
}
`
,
{
...
@@ -323,11 +339,10 @@ export default function App() {
...
@@ -323,11 +339,10 @@ export default function App() {
</Tabs>
</Tabs>
</Box>
</Box>
{currentTab == 0 && <SearchPage list={searchResult} onSearch={setSearchResult} onLike={handleOn
L
ike} />}
{currentTab == 0 && <SearchPage list={searchResult} onSearch={setSearchResult} onLike={handleOn
l
ike} />}
{currentTab == 1 && <Favorites list={favorites} onLike={handleOnlike} />}
{currentTab == 1 && <Favorites list={favorites} onLike={handleOnlike} />}
{currentTab == 2 &&
{currentTab == 2 &&
<Typography align="center" variant="h2">Item Three</Typography>}
<Typography align="center" variant="h2">Item Three</Typography>}
</React.Fragment>
</React.Fragment>
)
)
}
}
This diff is collapsed.
Click to expand it.
src/MusicList.js
+
1
−
1
View file @
fa4776e6
This diff is collapsed.
Click to expand it.
src/SearchPage.js
+
1
−
1
View file @
fa4776e6
This diff is collapsed.
Click to expand it.
src/favorites.js
+
1
−
0
View file @
fa4776e6
...
@@ -73,3 +73,4 @@ export default Favorites;
...
@@ -73,3 +73,4 @@ export default Favorites;
// </React.Fragment>
// </React.Fragment>
// );
// );
// }
// }
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment