Skip to content

Commit

Permalink
Emergency Fix (#444)
Browse files Browse the repository at this point in the history
* emergency fix

* changed alert to console.log
  • Loading branch information
GhostOf0days authored Jan 16, 2024
1 parent 1a220a1 commit 2852e4a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/queryLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,23 @@ export async function queryLocations(
}
const { locations: rawLocations } =
await IAPIResponseJoiSchema.validateAsync(data);


// 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
alert(
console.log(
`${location.name} has invalid corresponding data! Ignoring location and continuing validation`,
);
}
return error === undefined;
}) as IReadOnlyAPILocation[];

return validLocations.map((location) => ({
...location,
name: toTitleCase(location.name ?? "Untitled"), // Convert names to title case
Expand Down

0 comments on commit 2852e4a

Please sign in to comment.