Skip to content

Commit

Permalink
[Feat] : 도서글 리스트 가장 최근에 작성한 글이 가장 맨 위로 가도록 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
nohYoom08 committed Jun 8, 2024
1 parent f45c8ae commit 1fc92bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/MyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function MyPage(){
apiMyPage(token)
.then(response=>{
setUserInfo({ name: response.data.result.name, id: response.data.result.id });
setHistoryList(response.data.result.histories);
setHistoryList(response.data.result.histories.sort((a,b)=>Number(b.id)-Number(a.id)));
console.log(response.data);
})
.catch(error=>{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Search(){
apiSearch(search,token)
.then(response=>{
console.log(response.data);
setSearchList(response.data.result);
setSearchList(response.data.result.sort((a,b)=>Number(b.id)-Number(a.id)));
})
.catch(error=>{
alert('통신 오류 또는 세션만료입니다.');
Expand Down

0 comments on commit 1fc92bc

Please sign in to comment.