diff --git a/src/hooks/useInput.ts b/src/hooks/useInput.ts index 8ed6f7f..3be2466 100644 --- a/src/hooks/useInput.ts +++ b/src/hooks/useInput.ts @@ -8,12 +8,8 @@ import { ChangeEvent, useState } from 'react'; const useInput = (initialValue: string) => { const [value, setValue] = useState(initialValue); - const handleChange = (event: ChangeEvent | string) => { - if (typeof event === 'string') { - setValue(event); - } else if (event?.target) { - setValue(event.target.value); - } + const handleChange = (event: ChangeEvent) => { + setValue(event.target.value); }; return { diff --git a/src/routes/private/real-boxes-create/DashboardCreateRealBox.tsx b/src/routes/private/real-boxes-create/DashboardCreateRealBox.tsx index daa4bd4..16afe22 100644 --- a/src/routes/private/real-boxes-create/DashboardCreateRealBox.tsx +++ b/src/routes/private/real-boxes-create/DashboardCreateRealBox.tsx @@ -49,7 +49,7 @@ interface Props { const DashboardCreateRealBoxPage = ({ initialValues, partiesData }: Props) => { const { user, isAdmin: isAdminUser } = useAuthContext(); const editMode = !!initialValues?.id; - const { value: keyword, onChange: handleKeyword, setValue: setKeyword } = useInput(''); + const [keyword, handleKeyword] = useState(''); const t = useMyTranslation(); const params = useSearchParams(); const { push } = useMyNavigation(); diff --git a/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx b/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx index cb31550..8f4a660 100644 --- a/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx +++ b/src/routes/private/real-boxes/DashboardRealBoxesPage.tsx @@ -54,7 +54,7 @@ const DashboardRealBoxesPage = (props: Props) => { () => real_box_requests.getAll({ page: page, - cargoId: keyword, + boxName: keyword, status: boxStatusFilter, direction: 'desc', sort: 'id',