From f7f166756825cf745f7320c07adc0724bc48b819 Mon Sep 17 00:00:00 2001 From: GhostOf0days Date: Tue, 16 Jan 2024 16:11:53 -0500 Subject: [PATCH] changed alert to console.log --- src/util/queryLocations.ts | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/util/queryLocations.ts b/src/util/queryLocations.ts index 6c39317c..3353c948 100644 --- a/src/util/queryLocations.ts +++ b/src/util/queryLocations.ts @@ -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,