Skip to content

Commit

Permalink
frontend: Prevent sending an empty version when fetching instances
Browse files Browse the repository at this point in the history
Sending an empty version is not allowed in the current API. That
should be ideally prevented in the backend, but until then, this
patch removes an empty version from the query params in the
respective API call.
  • Loading branch information
joaquimrocha committed Jun 22, 2022
1 parent 901f009 commit 31c28bd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/api/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,19 @@ export default class API {
static getInstances(
applicationID: string,
groupID: string,
queryOptions = {}
queryOptions: {
[key: string]: any;
} = {}
): Promise<Instances> {
let url = BASE_URL + '/apps/' + applicationID + '/groups/' + groupID + '/instances';

if (!_.isEmpty(queryOptions)) {
url += '?' + queryString.stringify(queryOptions);
let sanitizedOptions = queryOptions;
const { version, ...otherOptions } = queryOptions;
if (!version) {
sanitizedOptions = otherOptions;
}
url += '?' + queryString.stringify(sanitizedOptions);
}

return API.getJSON(url);
Expand Down

0 comments on commit 31c28bd

Please sign in to comment.