Skip to content

Commit

Permalink
Feat: 마인더 인증하기 실패 시 버튼 비활성화
Browse files Browse the repository at this point in the history
  • Loading branch information
rmdnps10 committed Jan 25, 2024
1 parent 5e4c137 commit 510e068
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/components/Common/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface ProfileProps {
profileIdentifier: number | undefined;
name: string | undefined;
levelStatus: string | undefined;
isPass?: boolean | undefined;
}
//일단 프로필 이미지는 한개만 불러왔음!
export const Profile = ({
Expand All @@ -22,6 +23,7 @@ export const Profile = ({
profileIdentifier,
name,
levelStatus,
isPass,
}: ProfileProps) => {
const navigate = useNavigate();
return (
Expand Down Expand Up @@ -96,12 +98,15 @@ export const Profile = ({
<VerifyButtonWrapper>
<VerifyButton
onClick={() => {
navigate('/seller/education/first');
if (isPass) {
navigate('/seller/education/first');
}
}}
width="100%"
backgroundColor={Green}
height="5.2rem"
text="마인더 인증하기"
isActive={isPass}
/>
</VerifyButtonWrapper>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,10 @@ export const ModifyProfileMainSection = ({
letterPrice.isError ||
chatPrice.isError ||
oneLiner.isError ||
experience.isError
experience.isError ||
// 한 줄 소개, 경험 소개 길이가 0일 경우
experience.value.length === 0 ||
oneLiner.value.length === 0
)
}
text={isNoProfile ? '작성 완료하기' : '저장하기'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const VerifyMaterialButtonWrapper = styled.div`
flex-direction: column;
align-items: center;
text-align: center;
gap: 0.6rem;
gap: 0.6rem;
padding-bottom: 1.6rem;
background-color: ${White};
position: fixed;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Seller/SellerMyPageModifyProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const SellerMypageModifyProfile = () => {
category.setViewValue(data?.consultCategories.join(', '));
setSelectCategory(
data?.consultCategories.map((item: any) => categoryList[item]),
);
);
style.setViewValue(data?.consultStyle);
setSelectStyle(data?.consultStyle);

Expand Down
10 changes: 8 additions & 2 deletions src/pages/Seller/SellerMypage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TabA1 } from 'components/Common/TabA1';
import { useNavigate } from 'react-router-dom';
import { Profile } from 'components/Common/Profile';
import { useEffect, useState } from 'react';
import { getMyInfo } from 'api/get';
import { getIsPassQuiz, getMyInfo } from 'api/get';
import { consultStyleToCharNum } from 'utils/convertStringToCharNum';
interface UserInfo {
nickname: string;
Expand All @@ -15,10 +15,15 @@ interface UserInfo {
export const SellerMypage = () => {
const navigate = useNavigate();
const [userInfo, setUserInfo] = useState<UserInfo>();
const [isPass, setIsPass] = useState(undefined);
useEffect(() => {
const fetchMyInfo = async () => {
const res: any = await getMyInfo();
setUserInfo(res.data);
if (!res?.data?.isEducated) {
const isPassRes: any = await getIsPassQuiz();
setIsPass(isPassRes?.data);
}
setUserInfo(res?.data);
};
fetchMyInfo();
}, []);
Expand All @@ -38,6 +43,7 @@ export const SellerMypage = () => {
isVerified={userInfo?.isEducated}
profileIdentifier={consultStyleToCharNum(userInfo?.consultStyle)}
isBuyer={false}
isPass={isPass}
/>
</>
);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Seller/SellerVerifyQuiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export const SellerVerifyQuiz = () => {
useEffect(() => {
const fetchIsPassQuiz = async () => {
const isPassRes: any = await getIsPassQuiz();
// isPassRes
if (!isPassRes?.data) {
alert('이미 퀴즈를 통과했습니다.');
alert('접근 권한이 없습니다.');
navigate('/seller/mypage');
}
};
Expand Down

0 comments on commit 510e068

Please sign in to comment.