| | |
| | | try { |
| | | const shelters = await this.props.shelterService.getAll(); |
| | | this.setState({shelters}); |
| | | // Set default shelter as first option. If we do not do this the form will not know which one is selected by default |
| | | // Set default shelter as first option. |
| | | //If we do not do this the form will not know which one is selected by default |
| | | if (shelters[0].shelterId) { |
| | | this.handleShelterIdChange(shelters[0].shelterId) |
| | | this.handleShelterIdChange(shelters[0].shelterId); |
| | | } |
| | | } catch (error) { |
| | | if (error instanceof RESTConnectionError) { |
| | |
| | | |
| | | private isFormValid() { |
| | | const {animal} = this.state; |
| | | const fieldIsEmpty = (field: string) => { return animal[field as keyof Animal] === ""; } |
| | | const fieldIsEmpty = (field: string) => { return animal[field as keyof Animal] === ""; }; |
| | | |
| | | const hasEmptyFields = Object |
| | | .keys(animal) |
| | |
| | | key={shelter.shelterId} |
| | | value={shelter.shelterId} |
| | | label={shelter.shelterName} |
| | | /> |
| | | />; |
| | | })} |
| | | </FormSelect> |
| | | </FormGroup> |
| | |
| | | key={approximateSize} |
| | | value={approximateSize} |
| | | label={approximateSize} |
| | | /> |
| | | />; |
| | | })} |
| | | </FormSelect> |
| | | </FormGroup> |