Skip to content
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 src/common/hooks/useHandleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useHandleError = () => {
const handleError = (error: Error, customMessage?: string) => {
if (isAxiosError<ErrorResponse>(error)) {
openToast({
message: error.response?.data.message || customMessage || '알 수 없는 오류가 발생했습니다',
message: customMessage || error.response?.data.message || '알 수 없는 오류가 발생했습니다',
});
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/features/detail/apis/usePostLike.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useHandleError } from '@/common/hooks/useHandleError';
import client from '@/common/utils/client';
import { QUERY_KEYS } from '@/libs/queryKeys';
import { useMutation, useQueryClient } from '@tanstack/react-query';
Expand All @@ -9,12 +10,16 @@ const postLike = async (itemId: number) => {

export const usePostLike = () => {
const queryClient = useQueryClient();
const handleError = useHandleError();

return useMutation({
mutationFn: postLike,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.ITEM_DETAIL] });
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.ITEM_LIST] });
},
onError: error => {
handleError(error, '로그인 후 시도해 주세요.');
},
});
};
15 changes: 15 additions & 0 deletions src/features/my/components/MyTrade/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,31 @@ import * as s from './style.css';
import { Link } from 'react-router';
import { usePostLogout } from '../../apis/usePostLogout';
import { useToast } from '@/common/hooks/useToast';
import { REPICKA_INSTAGRAM } from '@/libs/constants';

interface MenuProps {
Title: string;
Icon: string;
Addr: string;
Link?: string;
}

const Menu = ({ Title, Icon, Addr }: MenuProps) => {
const { mutate: postLogout } = usePostLogout();
const { openToast } = useToast();

if (Title === '문의하기') {
return (
<a href={REPICKA_INSTAGRAM} target="_blank" rel="noopener noreferrer" className={s.GoMenu}>
<div className={s.MenuContent}>
<span className={cx(`${Icon}`)} />
{Title}
</div>
<div className={cx('mgc_right_line', s.Icon)} />
</a>
);
}

if (Title !== '로그아웃') {
return (
<Link className={s.GoMenu} to={Addr}>
Expand Down Expand Up @@ -53,6 +67,7 @@ const MyTrade = () => {
<div className={s.Menu}>
<Menu Icon="mgc_heart_fill" Title="관심 목록" Addr="/liked" />
<Menu Icon="mgc_shopping_bag_1_fill" Title="나의 판매 내역" Addr="/my-trade" />
<Menu Icon="mgc_instagram_line" Title="문의하기" Addr="/my-trade" />
<Menu Icon="mgc_exit_fill" Title="로그아웃" Addr="/my-trade" />
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/libs/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const VERSION_NAME = 'v1.0.1';
export const VERSION_NAME = 'v1.0.2';
export const REPICKA_INSTAGRAM =
'https://www.instagram.com/repicka.shop?utm_source=ig_web_button_share_sheet&igsh=ZDNlZDc0MzIxNw==';

export const MAX_PRICE = 999999;
export const MAX_LOCATION = 100;
Expand Down