Skip to content

Commit

Permalink
Fixed the validation error
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-01k committed Aug 28, 2024
1 parent e0ac29e commit f023b21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/modules/notifSettings/EditNotificationSetting.form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const NotificationSettingsSchema = Yup.object().shape({
'Multi-range lower limit must be between lower limit and upper limit',
function (value) {
const { rangelowerlimit, rangeupperlimit } = this.parent;
return value >= rangelowerlimit && value <= rangeupperlimit;
return value > rangelowerlimit && value < rangeupperlimit;
}
),
otherwise: () => Yup.number(),
Expand All @@ -86,19 +86,19 @@ export const NotificationSettingsSchema = Yup.object().shape({
'Multi-range upper limit must be between lower limit and upper limit',
function (value) {
const { rangelowerlimit, rangeupperlimit } = this.parent;
return value >= rangelowerlimit && value <= rangeupperlimit;
return value > rangelowerlimit && value < rangeupperlimit;
}
),
otherwise: () => Yup.number(),
}),


defaultValue: Yup.number()
.when('enableRange', {
is: true,
.when('enableMultiRange', {
is: false,
then: () =>
Yup.number()
.min(1, getMinCharLimitMessage(1))
.min(0, getMinCharLimitMessage(0))
.required(getRequiredFieldMessage('Default Value'))
.test(
'is-within-range',
Expand All @@ -120,7 +120,7 @@ export const NotificationSettingsSchema = Yup.object().shape({
'Slider step value must not be greater than upper limit',
function (value) {
const { rangeupperlimit } = this.parent;
return value <= rangeupperlimit;
return value < rangeupperlimit;
}
),
otherwise: () => Yup.number(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const NotificationSettingsFooter: FC<NotificationSettingsFooterProps> = ({ newSe
},
onError: (error: any) => {
console.log('Error in adding setting', error);
setErrorMessage(error.message);
setErrorMessage('Error in saving settings. Please try again later');
},
}
);
Expand Down

0 comments on commit f023b21

Please sign in to comment.