Skip to content

Commit

Permalink
fix/#61: 조회 방식에 따라 다른 결과 처리
Browse files Browse the repository at this point in the history
부모의 자녀 조회, 자녀의 부모 조회의 다른 결과
 - 그에 맞는 처리 필요
  • Loading branch information
yh-project committed Aug 31, 2024
1 parent 5106214 commit 98b98c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions ssh-web/src/pages/Information/InformationFetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getMyChildren, getMyParents, getUserInfo } from '../../apis/userApi';
import dayjs from 'dayjs';
import { IChild, IUserInfoMascot } from '../../interfaces/userInterface';
import { getImgSrc } from '../../utils/userUtil';
import { showToast } from '../../utils/toastUtil';

export const InformationFetch = () => {
const userinfoQuery = useSuspenseQuery({
Expand Down Expand Up @@ -39,15 +40,19 @@ export const InformationFetch = () => {
})
.catch((err) => console.log(err));
} else {
getMyParents().then((res) => {
setRelated(() => {
const newRelated: IUserInfoMascot = {
src: getImgSrc(res.data.gender, 'PARENT'),
label: res.data.nickname,
};
return [newRelated];
getMyParents()
.then((res) => {
setRelated(() => {
const newRelated: IUserInfoMascot = {
src: getImgSrc(res.data.gender, 'PARENT'),
label: res.data.nickname,
};
return [newRelated];
});
})
.catch(() => {
showToast('error', '연결된 부모님이 없습니다');
});
});
}
}, []);

Expand Down
2 changes: 1 addition & 1 deletion ssh-web/src/pages/Information/Manage/ManageParentFetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const ManageParentFetch = () => {
</Typography>
</div>
<AvatarWithLabel
imageUrl={getImgSrc(userinfoQuery.data.data.gender, 'PARENT')}
imageUrl={getImgSrc(userinfoQuery.data.data.gender, 'CHILD')}
label={userinfoQuery.data.data.nickname}
altText="avatarwithlabel"
size="2xl"
Expand Down

0 comments on commit 98b98c5

Please sign in to comment.