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

리프레쉬 토큰 오류 코드 추가, 지원한 서포터 없을 경우 버튼 비활성화 #572

Merged
merged 2 commits into from
Sep 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ interface Props {
reviewStatus: ReviewStatus;
isRunner: boolean;
supporterId?: number;
applicantCount: number;
handleDeletePost: (handleDeletePost: number) => void;
}

const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId, handleDeletePost }: Props) => {
const MyPagePostButton = ({
runnerPostId,
reviewStatus,
isRunner,
supporterId,
applicantCount,
handleDeletePost,
}: Props) => {
const { goToSupportSelectPage, goToSupporterFeedbackPage } = usePageRouter();

const { isMobile } = useViewport();
Expand Down Expand Up @@ -78,6 +86,7 @@ const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId, h
fontWeight={700}
width={isMobile ? '100%' : '180px'}
height="40px"
disabled={applicantCount < 1}
onClick={isRunner ? handleClickSupportSelectButton : handleClickCancelReviewButton}
>
{isRunner ? '서포터 선택하기' : '리뷰 제안 취소'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const MyPagePostItem = ({

<MyPagePostButton
handleDeletePost={handleDeletePost}
applicantCount={applicantCount}
runnerPostId={runnerPostId}
isRunner={isRunner}
reviewStatus={reviewStatus}
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/components/common/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ interface Props extends React.HTMLProps<HTMLButtonElement> {
const Button = ({
colorTheme,
children,
width,
height,
type,
fontSize,
fontWeight,
onClick,
ariaLabel,
dataType,
disabled,
...buttonProps
}: Props) => {
return (
<S.ButtonWrapper>
<S.Button
data-type={dataType}
$width={width}
$height={height}
$colorTheme={colorTheme}
type={type}
$disabled={disabled}
$fontSize={fontSize}
$fontWeight={fontWeight}
onClick={onClick}
aria-label={ariaLabel}
{...buttonProps}
>
{children}
</S.Button>
Expand All @@ -57,6 +57,7 @@ const S = {
$height?: string | number;
$fontSize?: string | number;
$fontWeight?: number;
$disabled?: boolean;
}>`
${({ $colorTheme }) => themeStyles[$colorTheme]}

Expand All @@ -68,6 +69,8 @@ const S = {
font-size: ${({ $fontSize }) => $fontSize || '18px'};
font-weight: ${({ $fontWeight }) => $fontWeight || '400'};

visibility: ${({ $disabled }) => ($disabled ? 'hidden' : 'visible')};

@media (max-width: 768px) {
width: ${({ $width }) => $width || '180px'};
height: 100%;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useFetch = () => {

showErrorToast({
title: ERROR_TITLE.NO_PERMISSION,
description: ['JW007', 'JW008', 'JW009'].includes(apiError.errorCode)
description: ['JW007', 'JW008', 'JW009', 'JW010'].includes(apiError.errorCode)
? ERROR_DESCRIPTION.TOKEN_EXPIRATION
: ERROR_DESCRIPTION.NO_TOKEN,
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/mocks/data/myPagePost/myPagePostList.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"deadline": "2020-10-13T11:30",
"tags": ["java", "JAVA"],
"reviewStatus": "NOT_STARTED",
"applicantCount": 4,
"applicantCount": 0,
"watchedCount": 125,
"supporterId": 1
},
Expand Down