diff --git a/src/pages/MyPage.js b/src/pages/MyPage.js index f60812c..567ed07 100644 --- a/src/pages/MyPage.js +++ b/src/pages/MyPage.js @@ -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=>{ diff --git a/src/pages/Search.js b/src/pages/Search.js index f16f00f..c92682d 100644 --- a/src/pages/Search.js +++ b/src/pages/Search.js @@ -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('통신 오류 또는 세션만료입니다.');