Skip to content

Commit

Permalink
fix: 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Todari committed Sep 24, 2024
1 parent c15e20a commit f83da34
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 7 additions & 2 deletions client/src/components/Reports/Reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import useReportsPage from '@hooks/useReportsPage';
import {ExpenseList, Flex} from '@HDesign/index';

const Reports = () => {
const {isEmpty, expenseListProp, name, changeName} = useReportsPage();
const {isEmpty, expenseListProp, memberName, changeName} = useReportsPage();

if (isEmpty) {
return <BillEmptyFallback />;
}

return (
<Flex flexDirection="column" gap="0.5rem">
<ExpenseList name={name} onSearch={changeName} placeholder="이름 검색" expenseList={expenseListProp} />
<ExpenseList
memberName={memberName}
onSearch={changeName}
placeholder="이름 검색"
expenseList={expenseListProp}
/>
</Flex>
);
};
Expand Down
8 changes: 4 additions & 4 deletions client/src/hooks/useReportsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {useSearchReports} from './useSearchReports';
import toast from './useToast/toast';

const useReportsPage = () => {
const [name, setName] = useState('');
const [memberName, setMemberName] = useState('');
const {bankName, accountNumber} = useOutletContext<EventPageContextProps>();
const {matchedReports, reports} = useSearchReports({name});
const {matchedReports, reports} = useSearchReports({memberName});

const changeName = ({target}: React.ChangeEvent<HTMLInputElement>) => {
setName(target.value);
setMemberName(target.value);
};

const onBankButtonClick = () => {
Expand All @@ -41,7 +41,7 @@ const useReportsPage = () => {
return {
isEmpty,
expenseListProp,
name,
memberName,
changeName,
};
};
Expand Down
6 changes: 3 additions & 3 deletions client/src/hooks/useSearchReports/useSearchReports.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import useRequestGetReports from '@hooks/queries/report/useRequestGetReports';

type UseSearchReportsParams = {
name: string;
memberName: string;
};

const useSearchReports = ({name}: UseSearchReportsParams) => {
const useSearchReports = ({memberName}: UseSearchReportsParams) => {
const {reports} = useRequestGetReports();

return {
matchedReports: reports.filter(memberReport => memberReport.memberName.includes(name)),
matchedReports: reports.filter(memberReport => memberReport.memberName.includes(memberName)),
reports,
};
};
Expand Down

0 comments on commit f83da34

Please sign in to comment.