Skip to content

Commit

Permalink
changed alert to console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostOf0days committed Jan 16, 2024
1 parent a93beb4 commit f7f1667
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/util/queryLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,22 @@ export async function queryLocations(
}
const { locations: rawLocations } =
await IAPIResponseJoiSchema.validateAsync(data);

// Revert after implementing merging algo
const validLocations = rawLocations as IReadOnlyAPILocation[];
const { error } = ILocationAPIJoiSchema.validate(location);
console.log(error);


// Check for invalid location data
// const validLocations = rawLocations.filter((location) => {
// const { error } = ILocationAPIJoiSchema.validate(location);
// if (error !== undefined) {
// console.error("Validation error!", error.details);
// // eslint-disable-next-line no-underscore-dangle
// console.error("original obj", error._original);
// // eslint-disable-next-line no-alert
// console.log(
// `${location.name} has invalid corresponding data! Ignoring location and continuing validation`,
// );
// }
// return error === undefined;
// }) as IReadOnlyAPILocation[];
const validLocations = rawLocations.filter((location) => {
const { error } = ILocationAPIJoiSchema.validate(location);
if (error !== undefined) {
console.error("Validation error!", error.details);
// eslint-disable-next-line no-underscore-dangle
console.error("original obj", error._original);
// eslint-disable-next-line no-alert
console.log(
`${location.name} has invalid corresponding data! Ignoring location and continuing validation`,
);
}
return error === undefined;
}) as IReadOnlyAPILocation[];

return validLocations.map((location) => ({
...location,
Expand Down

0 comments on commit f7f1667

Please sign in to comment.