From 2992df9c338d6b3a22b24602a95b9dd68e81f72f Mon Sep 17 00:00:00 2001 From: Matthew Oslan Date: Fri, 12 Jul 2019 20:04:25 -0400 Subject: [PATCH] Remove "pws:" prefix from PWS ID --- routes/adjustmentMethods/AdjustmentMethod.ts | 2 +- routes/weather.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/adjustmentMethods/AdjustmentMethod.ts b/routes/adjustmentMethods/AdjustmentMethod.ts index 514dabe..9b37574 100644 --- a/routes/adjustmentMethods/AdjustmentMethod.ts +++ b/routes/adjustmentMethods/AdjustmentMethod.ts @@ -57,7 +57,7 @@ export interface AdjustmentMethodResponse { } export interface AdjustmentOptions { - /** The ID of the PWS to use, prefixed with "pws:". */ + /** The ID of the PWS to use. */ pws?: string; /** The API key to use to access PWS data. */ key?: string; diff --git a/routes/weather.ts b/routes/weather.ts index 694438c..3456cb0 100644 --- a/routes/weather.ts +++ b/routes/weather.ts @@ -221,8 +221,8 @@ export const getWateringData = async function( req: express.Request, res: expres let pws: PWS | undefined = undefined; if ( adjustmentOptions.pws && adjustmentOptions.key ) { - const idMatch = adjustmentOptions.pws.match( /^pws:([a-zA-Z\d]+)$/ ); - const pwsId = idMatch ? idMatch[ 1 ] : undefined; + const idMatch = adjustmentOptions.pws.match( /^[a-zA-Z\d]+$/ ); + const pwsId = idMatch ? idMatch[ 0 ] : undefined; const keyMatch = adjustmentOptions.key.match( /^[a-f\d]{32}$/ ); const apiKey = keyMatch ? keyMatch[ 0 ] : undefined;