Skip to content

Commit

Permalink
Merge pull request #351 from ndustrialio/feat/output-fields-include-a…
Browse files Browse the repository at this point in the history
…fter-query-param

feat: parse the `after` query param from the outputfields data url
  • Loading branch information
andreimoustache authored Nov 7, 2024
2 parents 67ed0f9 + cd8e20b commit 11d1d66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/iot/parseOutputFieldNextPageUrlMetadata.js
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -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);
}
Expand Down

0 comments on commit 11d1d66

Please sign in to comment.