Skip to content

Commit

Permalink
[fix] 필터수정 #1388
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangmin Park authored and Sangmin Park committed Apr 15, 2024
1 parent 62943a1 commit 50c2c68
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TableContainer,
TableRow,
} from '@mui/material';
import { IcheckItem } from 'types/admin/adminRecruitmentsTypes';
import {
AdminEmptyItem,
AdminTableHead,
Expand Down Expand Up @@ -47,7 +48,7 @@ function DetailRecruitUserList({ recruitId }: { recruitId: number }) {

return (
<>
{/* {RecruitmentFilterOptions(recruitUserData.applicationResults, recruitId)} */}
<RecruitmentFilterOptions recruitId={recruitId} />
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='customized table'>
<TableHead className={styles.tableHeader}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,15 @@ const MenuProps = {
},
};

function RecruitmentFilterOptions(
recruitUserData: IrecruitUserTable[],
recruitId: number
) {
const { checklistIds, handleChecklistChange } =
function RecruitmentFilterOptions({ recruitId }: { recruitId: number }) {
const { checklistIds, handleChecklistChange, recruitUserData } =
useRecruitmentUserFilter(recruitId);
const [answers, setAnswers] = useState<Array<IcheckItem>>([]);

useEffect(() => {
setAnswers(
recruitUserData.reduce((acc, recruit) => {
recruit.form.forEach((formItem) => {
recruitUserData.applicationResults.reduce((acc, recruit) => {
recruit.form?.forEach((formItem) => {
if (formItem.inputType !== 'TEXT') {
formItem.checkedList?.forEach((item) => {
if (!acc.some((answer) => answer.checkId === item.checkId)) {
Expand Down
11 changes: 10 additions & 1 deletion hooks/recruitments/useRecruitmentUserFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ const useRecruitmentUserFilter = (recruitId: number) => {
// }
// );
const res = await instance.get(
`/admin/recruitments/${recruitId}/applicants`
`/admin/recruitments/${recruitId}/applicants`,
{
params: {
page: 1,
size: 20,
// question: questions,
checks: checklistIds.map((check) => check).join(','),
search: searchString,
},
}
);
// FIXME: 페이지네이션 x (페이지네이션이 없는 api?) 임시로 1페이지로 고정
console.log(res.data);
Expand Down

0 comments on commit 50c2c68

Please sign in to comment.