refactor: ajout d'un prop onSubmit à EntrepriseInput

feat/1633-ajout-recherche-entreprise-simulateurs-ter
Alice Dahan 2024-11-05 11:17:32 +01:00
parent 6eb97e1512
commit 9cdd44a5e6
1 changed files with 6 additions and 1 deletions

View File

@ -12,13 +12,18 @@ import { resetCompany } from '@/store/actions/companyActions'
import SelectedEntrepriseDetails from '../entreprise/SelectedEntrepriseDetails'
export default function EntrepriseInput() {
type Props = {
onSubmit?: (établissement: Entreprise | null) => void
}
export default function EntrepriseInput({ onSubmit }: Props) {
const companySIREN = useEngine().evaluate('entreprise . SIREN').nodeValue
useSetEntrepriseFromUrssafConnection()
const setEntreprise = useSetEntreprise()
const dispatch = useDispatch()
const handleCompanySubmit = (établissement: Entreprise | null) => {
setEntreprise(établissement)
onSubmit?.(établissement)
}
const handleCompanyClear = () => {
dispatch(resetCompany())