From cd8e20b24730fe769a01c2d6fe440a79c4ed0c5a Mon Sep 17 00:00:00 2001 From: Andrei Mustata Date: Thu, 7 Nov 2024 12:55:47 +0200 Subject: [PATCH] feat: parse the `after` query param from the outputfields data url --- src/utils/iot/parseOutputFieldNextPageUrlMetadata.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js b/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js index 4d48ee72..a6a84335 100644 --- a/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js +++ b/src/utils/iot/parseOutputFieldNextPageUrlMetadata.js @@ -1,5 +1,7 @@ import URL from 'url-parse'; +const allowedQueryParams = ['after', 'limit', 'timeEnd', 'timeStart', 'window']; + /** * Parses metadata from the provided url. Will coerce fields that should be * numbers from `String` to `Number` @@ -21,7 +23,7 @@ import URL from 'url-parse'; function parseOutputFieldNextPageUrlMetadata(url) { const query = new URL(url, true).query; - return ['limit', 'timeEnd', 'timeStart', 'window'].reduce((memo, key) => { + return allowedQueryParams.reduce((memo, key) => { if (memo[key]) { memo[key] = parseInt(memo[key], 10); }