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

Bug/333 #368

Merged
merged 22 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d21ac20
Merge branch 'dev' into feat/261
devkyoung2 Jun 14, 2024
da98c5d
[fix]: 펀딩목표금액을 0원으로 등록하는 것을 막음(#333)
devkyoung2 Jun 14, 2024
234ec14
[refactor]: 빈 객체 체크 유틸함수로 분리(#333)
devkyoung2 Jun 14, 2024
4c7dd49
[refactor]: 진행중인 펀딩 아이템이 있을 경우 펀딩을 막음(#333)
devkyoung2 Jun 14, 2024
a8805c1
[refactor]: 나의 위시리스트 조회 응답 타입 수정 (#306)
uraflower May 28, 2024
0f1a5a9
[feat]: 친구의 위시리스트 조회 API 연동 (#306)
uraflower May 28, 2024
23dbe52
[feat]: 나의 위시리스트 페이징 조회 적용 (#306)
uraflower May 28, 2024
87fcb52
[feat]: 장바구니 버튼 핸들러 구현 (#355)
uraflower Jun 10, 2024
f7a132d
[feat]: 상품 상세 조회 페이지 장바구니 등록 버튼 핸들러 구현 (#355)
uraflower Jun 10, 2024
f92cd4d
[feat]: 장바구니 담기 전 로그인/옵션선택 여부 확인 (#355)
uraflower Jun 10, 2024
3309291
[fix]: 잘못된 변수 참조 변경 (#355)
uraflower Jun 13, 2024
ad8ee50
[refactor]: checkLoginBeforeAction 함수 추출 (#361)
uraflower Jun 10, 2024
8d30b22
[feat]: 상품 상세조회 api 응답 타입 수정(#334)
devkyoung2 Jun 7, 2024
2b01183
[feat]: 위시 클릭시 위시 색상 변경(#334)
devkyoung2 Jun 7, 2024
0f615c4
[refactor]: 의미없는 코드 삭제(#334)
devkyoung2 Jun 10, 2024
20523a0
[refactor]: 변수명을 직관적으로 변경(#334)
devkyoung2 Jun 10, 2024
79b28a4
[fix]: 펀딩목표금액을 0원으로 등록하는 것을 막음(#333)
devkyoung2 Jun 14, 2024
054788a
[refactor]: 빈 객체 체크 유틸함수로 분리(#333)
devkyoung2 Jun 14, 2024
31ad7ad
[refactor]: 진행중인 펀딩 아이템이 있을 경우 펀딩을 막음(#333)
devkyoung2 Jun 14, 2024
02167ba
Merge branch 'bug/333' of https://github.com/KakaoFunding/front-end i…
devkyoung2 Jun 14, 2024
6991f20
Merge branch 'dev' into bug/333
devkyoung2 Jun 17, 2024
ae9b7de
Merge branch 'dev' into bug/333
devkyoung2 Jun 18, 2024
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
5 changes: 5 additions & 0 deletions src/components/ui/Modal/FundingModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
});

const handleAddFunding = async () => {
if (formatCommaToNumber(goalAmount) === 0) {
alert('목표 금액은 0원일 수 없습니다.');

Check warning on line 49 in src/components/ui/Modal/FundingModal/index.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected alert

return;
}
await sendRequest();
close();
};
Expand Down
14 changes: 14 additions & 0 deletions src/layouts/Product/BuyInfo/ButtonBundles/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useQuery } from '@tanstack/react-query';

import clsx from 'clsx';
import { useNavigate } from 'react-router-dom';

Expand All @@ -11,7 +13,9 @@
import { useKakaoPicker } from 'hooks/useKakaoPicker';
import { useLogin } from 'hooks/useLogin';
import { useModal } from 'hooks/useModal';
import { getMyFundingItem } from 'services/api/v1/funding';
import { formatNumberWithPlus } from 'utils/format';
import { isEmptyObject } from 'utils/validate';

import { RequestOrderPreview } from 'types/payment';
import { OptionDetail, ProductDescriptionResponse } from 'types/product';
Expand Down Expand Up @@ -48,6 +52,11 @@
useSelectedFriendsStore();
const { openKakaoPicker } = useKakaoPicker();

const { data } = useQuery({
queryKey: ['myFundingItem'],
queryFn: () => getMyFundingItem(),
});

const {
isOpen: isFundingOpen,
open: openFundingModal,
Expand Down Expand Up @@ -95,7 +104,7 @@
// 옵션 선택 여부 확인
const checkOptionBeforeAction = (action: () => void) => {
if (hasOption && !selectedOption) {
alert('옵션을 선택해주세요');

Check warning on line 107 in src/layouts/Product/BuyInfo/ButtonBundles/index.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected alert
return;
}
action();
Expand All @@ -104,6 +113,11 @@
// 펀딩 등록 버튼 핸들러
const handleClickFunding = () => {
checkLoginBeforeAction(() => {
if (!isEmptyObject(data!)) {
alert('이미 등록된 펀딩 아이템이 있습니다.');

Check warning on line 117 in src/layouts/Product/BuyInfo/ButtonBundles/index.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected alert
return;
}

checkOptionBeforeAction(openFundingModal);
});
};
Expand Down Expand Up @@ -135,7 +149,7 @@
} else if (selectedFriends.length === 1) {
navigate('/bill/gift', { state: { orderInfos, giftFor: 'friends' } });
} else {
alert('지금은 한 번에 한 명에게만 선물할 수 있어요.');

Check warning on line 152 in src/layouts/Product/BuyInfo/ButtonBundles/index.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected alert
}
});
};
Expand Down
5 changes: 1 addition & 4 deletions src/pages/MyPage/Funding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ import FundingProgress from 'layouts/MyPage/Funding/FundingProgress';
import { useUserStore } from 'store/useUserStore';

import { getMyFundingItem } from 'services/api/v1/funding';
import { isEmptyObject } from 'utils/validate';

import styles from './index.module.scss';

const isEmptyObject = (obj: object): boolean => {
return Object.keys(obj).length === 0;
};

const Funding = () => {
const { name } = useUserStore();
const { data, isFetched, isLoading } = useQuery({
Expand Down
4 changes: 4 additions & 0 deletions src/utils/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ export const isValidQuantity = (quantity: string) => {
export const isValidPrice = (price: string) => {
return isPositiveInteger(price) || isZero(price);
};

export const isEmptyObject = (obj: object): boolean => {
return Object.keys(obj).length === 0;
};
Loading