Skip to content

Commit

Permalink
feat: book marked handleApi 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyo-4 committed May 23, 2024
1 parent cbf9d1a commit b958d24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/JD/Experience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { QuestionType } from "../../types/experience";
import { bookmarkpatch } from "../../services/JD/bookmarkApi";
import { getCookie } from "../../services/cookie";
import { useParams } from "react-router-dom";
import { getAllExperienceList } from "../../services/JD/ExperienceApi";

interface ExpProps {
type?: "card" | "section";
Expand All @@ -26,7 +27,7 @@ interface ExpProps {
detail?: QuestionType[];
checkedKeywords?: string[];
onClick?: () => void;
handleApi?: (jdid: string, token: string) => void;
handleApi?: (jdId: string, token: string) => Promise<void>;
}

const Experience: React.FC<ExpProps> = ({
Expand All @@ -52,6 +53,19 @@ const Experience: React.FC<ExpProps> = ({
// 카드 타입, 섹션 타입 구분
const isSection = type === "section";

const getExperienceList = async (jdId: string, token: string) => {
try {
const response = await getAllExperienceList(jdId, token);
//console.log(response);
if (handleApi) {
handleApi(jdId, user.token);
}
} catch (error) {
console.error(error);
alert(JSON.stringify(error));
}
};

// 경험의 선택된 질문 답변
const answer = detail?.[(question || 1) - 1]?.answer;

Expand Down
1 change: 1 addition & 0 deletions src/components/JD/ExperienceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ const ExperienceList: React.FC<ExperienceListProps> = ({
(item: KeywordType) => item.name
)}
onClick={() => setshowDetail(true)}
handleApi={getExperienceList}
/>
))}
</ScrollDiv>
Expand Down

0 comments on commit b958d24

Please sign in to comment.