fix: Handle invalid frequency in ChoreEdit component
This commit is contained in:
parent
e78008baea
commit
cdf90ff582
2 changed files with 8 additions and 5 deletions
|
@ -113,8 +113,8 @@ const ChoreEdit = () => {
|
|||
if (assignedTo < 0) {
|
||||
errors.assignedTo = 'Assigned to is required'
|
||||
}
|
||||
if (frequencyType === 'interval' && frequency < 1) {
|
||||
errors.frequency = 'Frequency is required'
|
||||
if (frequencyType === 'interval' && !frequency > 0) {
|
||||
errors.frequency = `Invalid frequency, the ${frequencyMetadata.unit} should be > 0`
|
||||
}
|
||||
if (
|
||||
frequencyType === 'days_of_the_week' &&
|
||||
|
|
|
@ -124,12 +124,15 @@ const RepeatOnSections = ({
|
|||
<Grid item sm={12} sx={{ display: 'flex', alignItems: 'center' }}>
|
||||
<Typography level='h5'>Every: </Typography>
|
||||
<Input
|
||||
slotProps={{
|
||||
input: {
|
||||
min: 1,
|
||||
max: 1000,
|
||||
},
|
||||
}}
|
||||
type='number'
|
||||
value={frequency}
|
||||
onChange={e => {
|
||||
if (e.target.value < 1) {
|
||||
e.target.value = 1
|
||||
}
|
||||
onFrequencyUpdate(e.target.value)
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Add table
Reference in a new issue