Skip to content

Commit

Permalink
Added querystring search get option (#4658) (#4674)
Browse files Browse the repository at this point in the history
Co-authored-by: Rob Gietema <rob.gietema@gmail.com>
  • Loading branch information
sneridagh and robgietema committed Apr 11, 2023
1 parent 0aa259f commit f0c4990
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions news/4658.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added querystring search get option. @robgietema
34 changes: 20 additions & 14 deletions src/actions/querystringsearch/querystringsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,30 @@ export function getQueryStringResults(path, data, subrequest, page) {
}
}

const query = {
...requestData,
...(!requestData.b_size && {
b_size: settings.defaultPageSize,
}),
...(page && {
b_start: requestData.b_size
? data.b_size * (page - 1)
: settings.defaultPageSize * (page - 1),
}),
query: requestData?.query,
};

return {
type: GET_QUERYSTRING_RESULTS,
subrequest,
request: {
op: 'post',
path: `${path}/@querystring-search`,
data: {
...requestData,
...(!requestData.b_size && {
b_size: settings.defaultPageSize,
}),
...(page && {
b_start: requestData.b_size
? data.b_size * (page - 1)
: settings.defaultPageSize * (page - 1),
}),
query: requestData?.query,
},
op: settings.querystringSearchGet ? 'get' : 'post',
path: `${path}/@querystring-search${
settings.querystringSearchGet
? `?query=${encodeURIComponent(JSON.stringify(query))}`
: ''
}`,
data: settings.querystringSearchGet ? null : query,
},
};
}
1 change: 1 addition & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ let config = {
styleClassNameConverters,
hashLinkSmoothScroll: false,
styleClassNameExtenders,
querystringSearchGet: false,
},
experimental: {
addBlockButton: {
Expand Down

0 comments on commit f0c4990

Please sign in to comment.