diff --git a/frontend/src/api/interceptors.ts b/frontend/src/api/interceptors.ts index e164d9f5b..feb1f447d 100644 --- a/frontend/src/api/interceptors.ts +++ b/frontend/src/api/interceptors.ts @@ -72,5 +72,5 @@ export const handleAPIError = (error: AxiosError) => { throw new HTTPError(HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR, data.message); } - throw new HTTPError(status, data.message); + throw new HTTPError(status, data.message, data.code); }; diff --git a/frontend/src/assets/svg/empty-like.svg b/frontend/src/assets/svg/empty-like.svg index 303b7109b..c636b96da 100644 --- a/frontend/src/assets/svg/empty-like.svg +++ b/frontend/src/assets/svg/empty-like.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/frontend/src/pages/MyTripsPage/MyTripsPage.tsx b/frontend/src/pages/MyTripsPage/MyTripsPage.tsx index 88e00e5ed..13b3ad625 100644 --- a/frontend/src/pages/MyTripsPage/MyTripsPage.tsx +++ b/frontend/src/pages/MyTripsPage/MyTripsPage.tsx @@ -9,7 +9,7 @@ import TripsItemList from '@components/trips/TripsItemList/TripsItemList'; import { useTripsQuery } from '@hooks/api/useTripsQuery'; -import { sortByStartDate } from '@utils/sort'; +import { sortByNewest, sortByStartDate } from '@utils/sort'; import { ORDER_BY_DATE, ORDER_BY_REGISTRATION } from '@constants/order'; import { PATH } from '@constants/path'; @@ -21,7 +21,9 @@ const TripsPage = () => { useSelect(ORDER_BY_REGISTRATION); const sortedTrips = - sortSelected === ORDER_BY_DATE ? tripsData?.slice().sort(sortByStartDate) : tripsData; + sortSelected === ORDER_BY_DATE + ? tripsData?.slice().sort(sortByStartDate) + : tripsData?.slice().sort(sortByNewest); return ( <> diff --git a/frontend/src/utils/sort.ts b/frontend/src/utils/sort.ts index b5cfa6565..bf40dcb00 100644 --- a/frontend/src/utils/sort.ts +++ b/frontend/src/utils/sort.ts @@ -6,3 +6,10 @@ export const sortByStartDate = (a: TripsData, b: TripsData) => { return dateB.getTime() - dateA.getTime(); }; + +export const sortByNewest = (a: TripsData, b: TripsData) => { + const tripA = a.id; + const tripB = b.id; + + return tripB - tripA; +};