Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

커뮤니티 하트 svg 수정, 최신순정렬 수정 #733

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/api/interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ export const handleAPIError = (error: AxiosError<ErrorResponseData>) => {
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);
};
2 changes: 1 addition & 1 deletion frontend/src/assets/svg/empty-like.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions frontend/src/pages/MyTripsPage/MyTripsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 (
<>
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/utils/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};