diff --git a/src/api/resumes.ts b/src/api/resumes.ts index 5643e704..99918400 100644 --- a/src/api/resumes.ts +++ b/src/api/resumes.ts @@ -3,6 +3,7 @@ import { EducationRequest, IntroDuctionRequest, LanguagesLevelType, + LanguagesSummariesResponse, UserResumeDetailResponse, WorkExperienctRequest, } from '@/types/api/resumes'; @@ -32,7 +33,9 @@ export const getEducation = async (id: number) => { }; // 7.4 언어 요약 조회하기 -export const getLanguagesSummaries = async () => { +export const getLanguagesSummaries = async (): Promise< + RESTYPE +> => { const response = await api.get('/users/resumes/languages/summaries'); return response.data; }; diff --git a/src/components/Language/LanguageCard.tsx b/src/components/Language/LanguageCard.tsx index e120ee6e..837263d1 100644 --- a/src/components/Language/LanguageCard.tsx +++ b/src/components/Language/LanguageCard.tsx @@ -39,7 +39,7 @@ const LanguageCard = ({ const goToWebSite = [ { - language: 'TOPIC', + language: 'TOPIK', site: 'https://www.topik.go.kr/TWMAIN/TWMAIN0010.do', }, { @@ -54,6 +54,7 @@ const LanguageCard = ({ // 현재 title과 일치하는 사이트 URL 찾기 const siteInfo = goToWebSite.find((item) => item.language === title); + console.log(level); return ( <> diff --git a/src/components/Language/LanguageSection.tsx b/src/components/Language/LanguageSection.tsx index cfdbc485..1452cf17 100644 --- a/src/components/Language/LanguageSection.tsx +++ b/src/components/Language/LanguageSection.tsx @@ -8,11 +8,16 @@ import { useGetLanguagesSummaries } from '@/hooks/api/useResume'; const LanguageSection = () => { const { data } = useGetLanguagesSummaries(); const navigage = useNavigate(); + + // 언어 레벨 리스트 상태 관리 const [languageData, SetLanguageData] = useState(); + // 7.4 (유학생) 언어 요약 조회하기 useEffect(() => { - SetLanguageData(data); + if (data) { + SetLanguageData(data.data); + } }, [data]); return ( @@ -22,15 +27,16 @@ const LanguageSection = () => {

Language

Add
+ {/* 언어 추가 화면 이동 */} navigage('/resume/language/add')} className="cursor-pointer" />
- {/* TOPIC */} + {/* TOPIK */} { maxLevel={6} /> {/* 별도의 언어 추가 카드 */} - {languageData.additional_language.map((language) => ( -
- -
- ))} + {languageData.additional_language?.length > 0 && + languageData.additional_language.map((language) => ( +
+ +
+ ))}
) : ( diff --git a/src/hooks/api/useResume.ts b/src/hooks/api/useResume.ts index d6de1d50..e108fbc8 100644 --- a/src/hooks/api/useResume.ts +++ b/src/hooks/api/useResume.ts @@ -61,6 +61,9 @@ export const usePatchLanguagesLevel = ({ }) => { return useMutation({ mutationFn: () => patchLanguagesLevel({ type, level }), + onSuccess: () => { + window.location.reload(); + }, onError: (error) => { console.error('언어 레벨 수정 실패', error); }, diff --git a/src/hooks/api/useSetting.ts b/src/hooks/api/useSetting.ts index 835046b5..f50404e5 100644 --- a/src/hooks/api/useSetting.ts +++ b/src/hooks/api/useSetting.ts @@ -11,7 +11,7 @@ export const usePatchNotificationAllowed = () => { return useMutation({ mutationFn: patchNotificationAllowed, onSuccess: () => { - window.location.reload; + window.location.reload(); }, onError: (error) => { console.error('알람 설정 변경 실패', error); diff --git a/src/types/api/resumes.ts b/src/types/api/resumes.ts index 49e5a198..c4b6f5ca 100644 --- a/src/types/api/resumes.ts +++ b/src/types/api/resumes.ts @@ -34,7 +34,7 @@ export type EducationRequest = { // 언어 레벨 수정 API 통합시 type property로 사용 export type LanguagesLevelType = - | 'topic' + | 'topik' | 'social-integration-program' | 'sejong-institute';