diff --git a/src/modules/SelsoList/SelsoList.jsx b/src/modules/SelsoList/SelsoList.jsx index 33020fc..f47da7d 100644 --- a/src/modules/SelsoList/SelsoList.jsx +++ b/src/modules/SelsoList/SelsoList.jsx @@ -5,13 +5,14 @@ import Modal from 'src/components/Modal'; import SelsoItemCard from './SelsoItemCard'; import styles from './SelsoList.module.scss'; -import { selsoCost } from 'src/constants/costs'; const SelsoList = inject('selsoListStore', 'userStore', 'myPointStore')( - observer(({ selsoListStore, userStore, myPointStore, history }) => { + observer(({ selsoListStore, userStore, history }) => { const [isOpenSpendPointModal, setIsOpenSpendPointModal] = useState(false); const [isOpenPointLackModal, setIsOpenPointLackModal] = useState(false); - + const [isOpenHaveNotSelsoProfileModal, setIsOpenHaveNotSelsoProfileModal] = useState(false); + const [isOpenNotActiveSelsoProfileModal, setIsOpenNotActiveSelsoProfileModal] = useState(false); + useEffect(() => { if (userStore.profile?.gender && userStore.profile?.university) { if (userStore.profile.gender === 'MALE') { @@ -23,22 +24,40 @@ const SelsoList = inject('selsoListStore', 'userStore', 'myPointStore')( }, [userStore.profile?.gender, userStore.profile?.university]); const moveToDetailPageHandler = (selsoItem) => (_e) => { - selsoListStore.setChoosedSelso(selsoItem); + selsoListStore.getMySelsoProfile() + .then((res) => { + if (res.status === 404) { + setIsOpenHaveNotSelsoProfileModal(true); + } else if (res.status === 200) { + selsoListStore.setChoosedSelso(selsoItem); - if (selsoItem.isViewed) { - history.push('selso/detail'); - } else { - setIsOpenSpendPointModal(true); - } + if (selsoItem.isViewed) { + selsoListStore.fetchSelsoDetail() + .then((res) => { + if (res.status === 200) { + history.push('selso/detail'); + } else if (res.status === 403) { + setIsOpenNotActiveSelsoProfileModal(true); + } + }); + } else { + setIsOpenSpendPointModal(true); + } + } + }); }; const spendPointAndMoveToDetailPage = () => { - if (myPointStore.restPoint >= selsoCost.ViewProfileDetail) { - history.push('selso/detail'); - } else { - setIsOpenSpendPointModal(false); - setIsOpenPointLackModal(true); - } + selsoListStore.fetchSelsoDetail() + .then((res) => { + if (res.status === 200) { + selsoListStore.root.myPointStore.fetchMyPointHistory(); + history.push('selso/detail'); + } else if (res.status === 403) { + setIsOpenSpendPointModal(false); + setIsOpenPointLackModal(true); + } + }); }; return ( @@ -49,18 +68,62 @@ const SelsoList = inject('selsoListStore', 'userStore', 'myPointStore')( )) - } - setIsOpenPointLackModal(false)} + } + setIsOpenPointLackModal(false)} + > +

포인트가 부족합니다.
학교 인증이 완료되면 30포인트가 지급됩니다.

+

학생증 이미지를 업로드하지 않으신 분은 회원가입 마무리를 해주세요.
이미지를 확인하고 포인트를 지급하는 데 시간이 걸릴 수 있습니다.

+
+ setIsOpenHaveNotSelsoProfileModal(false)} + buttonList={[ + , + , + ]} + > +

셀소 프로필 등록 후 이용해주세요.

+
+ setIsOpenNotActiveSelsoProfileModal(false)} + buttonList={[ + , + , + ]} + > +

셀소 프로필을 공개 후 이용해주세요.

+
+ setIsOpenSpendPointModal(false)} + buttonList={[