Skip to content

Commit 0a46c53

Browse files
authored
Merge pull request #231 from DevKor-github/dev
[๋ฐฐํฌ] ๋น„๋กœ๊ทธ์ธ ์‚ฌ์šฉ์ž ์ข‹์•„์š” ํ† ์ŠคํŠธ ์ฒ˜๋ฆฌ, ๋ฌธ์˜ํ•˜๊ธฐ ๋ฒ„ํŠผ
2 parents 37be0fc + b797ff4 commit 0a46c53

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

โ€Žsrc/common/hooks/useHandleError.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const useHandleError = () => {
88
const handleError = (error: Error, customMessage?: string) => {
99
if (isAxiosError<ErrorResponse>(error)) {
1010
openToast({
11-
message: error.response?.data.message || customMessage || '์•Œ ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค',
11+
message: customMessage || error.response?.data.message || '์•Œ ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค',
1212
});
1313
}
1414
};

โ€Žsrc/features/detail/apis/usePostLike.tsโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useHandleError } from '@/common/hooks/useHandleError';
12
import client from '@/common/utils/client';
23
import { QUERY_KEYS } from '@/libs/queryKeys';
34
import { useMutation, useQueryClient } from '@tanstack/react-query';
@@ -9,12 +10,16 @@ const postLike = async (itemId: number) => {
910

1011
export const usePostLike = () => {
1112
const queryClient = useQueryClient();
13+
const handleError = useHandleError();
1214

1315
return useMutation({
1416
mutationFn: postLike,
1517
onSuccess: () => {
1618
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.ITEM_DETAIL] });
1719
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.ITEM_LIST] });
1820
},
21+
onError: error => {
22+
handleError(error, '๋กœ๊ทธ์ธ ํ›„ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.');
23+
},
1924
});
2025
};

โ€Žsrc/features/my/components/MyTrade/index.tsxโ€Ž

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,31 @@ import * as s from './style.css';
33
import { Link } from 'react-router';
44
import { usePostLogout } from '../../apis/usePostLogout';
55
import { useToast } from '@/common/hooks/useToast';
6+
import { REPICKA_INSTAGRAM } from '@/libs/constants';
67

78
interface MenuProps {
89
Title: string;
910
Icon: string;
1011
Addr: string;
12+
Link?: string;
1113
}
1214

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

19+
if (Title === '๋ฌธ์˜ํ•˜๊ธฐ') {
20+
return (
21+
<a href={REPICKA_INSTAGRAM} target="_blank" rel="noopener noreferrer" className={s.GoMenu}>
22+
<div className={s.MenuContent}>
23+
<span className={cx(`${Icon}`)} />
24+
{Title}
25+
</div>
26+
<div className={cx('mgc_right_line', s.Icon)} />
27+
</a>
28+
);
29+
}
30+
1731
if (Title !== '๋กœ๊ทธ์•„์›ƒ') {
1832
return (
1933
<Link className={s.GoMenu} to={Addr}>
@@ -53,6 +67,7 @@ const MyTrade = () => {
5367
<div className={s.Menu}>
5468
<Menu Icon="mgc_heart_fill" Title="๊ด€์‹ฌ ๋ชฉ๋ก" Addr="/liked" />
5569
<Menu Icon="mgc_shopping_bag_1_fill" Title="๋‚˜์˜ ํŒ๋งค ๋‚ด์—ญ" Addr="/my-trade" />
70+
<Menu Icon="mgc_instagram_line" Title="๋ฌธ์˜ํ•˜๊ธฐ" Addr="/my-trade" />
5671
<Menu Icon="mgc_exit_fill" Title="๋กœ๊ทธ์•„์›ƒ" Addr="/my-trade" />
5772
</div>
5873
</div>

โ€Žsrc/libs/constants/index.tsโ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const VERSION_NAME = 'v1.0.1';
1+
export const VERSION_NAME = 'v1.0.2';
2+
export const REPICKA_INSTAGRAM =
3+
'https://www.instagram.com/repicka.shop?utm_source=ig_web_button_share_sheet&igsh=ZDNlZDc0MzIxNw==';
24

35
export const MAX_PRICE = 999999;
46
export const MAX_LOCATION = 100;

0 commit comments

Comments
ย (0)