Skip to content

Commit

Permalink
feat: Added validation for area model (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslf97 authored Oct 15, 2024
1 parent 1f0e04e commit a494e7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/AreaCoordinates/hooks/AreaCoordinates.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export const validateCoordinates = async (
errors.area = 'You must select a model area';
}

if (area && area.coordinates[0].x > area.coordinates[1].x) {
errors.x0 = 'X start cannot be greater than X end.';
}
if (area && area.coordinates[0].y > area.coordinates[1].y) {
errors.y0 = 'Y start cannot be greater than Y end.';
}
if (area && area.coordinates[0].x === area.coordinates[1].x) {
errors.x0 = "X start/end coordinates can't be equal.";
}
Expand Down

0 comments on commit a494e7f

Please sign in to comment.