fix: 🐛 remove client daemon params and pass remaining params (#2097)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12301
This commit is contained in:
Cameron Perera authored and GitHub committed 2024-01-19 11:44:01 -06:00
1 parent c0793cd254
commit 3f2fc63b5b
1 file changed
+5 -3
@@ -41,11 +41,13 @@ const paginateResults = (array, page, pageSize) => {
const fetchControllerData = async (context, next) => {
const { data } = context.request;
const { query } = data;
const { recursive, scope_id, page, pageSize } = query;
const { query: originalQuery } = data;
// remove client daemon specific query params
// eslint-disable-next-line no-unused-vars
const { query, page, pageSize, ...remainingQuery } = originalQuery;
// If we get an error or client daemon is unavailable, fall back to calling the API
context.request.data.query = { recursive, scope_id };
context.request.data.query = remainingQuery;
const results = await next(context.request);
const models = results.content.toArray();