Skip to content

Commit

Permalink
search: allowing search param key to be modified
Browse files Browse the repository at this point in the history
  • Loading branch information
0einstein0 committed Jun 25, 2024
1 parent 64c5ce9 commit 9ddcd8a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/forms/RemoteSelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ export class RemoteSelectField extends Component {
}, this.props.debounceTime);

fetchSuggestions = async (searchQuery) => {
const { suggestionAPIUrl, suggestionAPIQueryParams, suggestionAPIHeaders } =
this.props;

const { suggestionAPIUrl, suggestionAPIQueryParams, suggestionAPIHeaders, searchParamKey } = this.props;

Check failure on line 106 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `·suggestionAPIUrl,·suggestionAPIQueryParams,·suggestionAPIHeaders,·searchParamKey` with `⏎······suggestionAPIUrl,⏎······suggestionAPIQueryParams,⏎······suggestionAPIHeaders,⏎······searchParamKey,⏎···`

Check failure on line 106 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (16.x)

Replace `·suggestionAPIUrl,·suggestionAPIQueryParams,·suggestionAPIHeaders,·searchParamKey` with `⏎······suggestionAPIUrl,⏎······suggestionAPIQueryParams,⏎······suggestionAPIHeaders,⏎······searchParamKey,⏎···`

Check failure on line 107 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Delete `··`

Check failure on line 107 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (16.x)

Delete `··`
try {
const response = await axios.get(suggestionAPIUrl, {
params: {
suggest: searchQuery,
[searchParamKey]: searchQuery,
size: DEFAULT_SUGGESTION_SIZE,
...suggestionAPIQueryParams,
},
Expand Down Expand Up @@ -259,6 +258,7 @@ RemoteSelectField.propTypes = {
suggestionAPIUrl: PropTypes.string.isRequired,
suggestionAPIQueryParams: PropTypes.object,
suggestionAPIHeaders: PropTypes.object,
searchParamKey: PropTypes.string,
serializeSuggestions: PropTypes.func,
serializeAddedValue: PropTypes.func,
initialSuggestions: PropTypes.oneOfType([
Expand All @@ -281,6 +281,7 @@ RemoteSelectField.defaultProps = {
debounceTime: 500,
suggestionAPIQueryParams: {},
suggestionAPIHeaders: {},
searchParamKey: 'suggest',

Check failure on line 284 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `'suggest'` with `"suggest"`

Check failure on line 284 in src/lib/forms/RemoteSelectField.js

View workflow job for this annotation

GitHub Actions / Tests (16.x)

Replace `'suggest'` with `"suggest"`
serializeSuggestions: serializeSuggestions,
suggestionsErrorMessage: "Something went wrong...",
noQueryMessage: "Search...",
Expand Down

0 comments on commit 9ddcd8a

Please sign in to comment.