aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/reducers/search.js')
-rw-r--r--src/client/react/reducers/search.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/react/reducers/search.js b/src/client/react/reducers/search.js
index d61689b..f566b49 100644
--- a/src/client/react/reducers/search.js
+++ b/src/client/react/reducers/search.js
@@ -6,7 +6,8 @@ const DEFAULT_STATE = {
results: [
{ type: 's', value: '18561' },
],
- exactMatch: null,
+ selectedResult: null,
+ isExactMatch: false,
};
function getSearchResults(query) {
@@ -28,12 +29,14 @@ const search = (state = DEFAULT_STATE, action) => {
switch (action.type) {
case 'SEARCH/INPUT_CHANGE': {
let results = getSearchResults(action.typedValue);
- let exactMatch = null;
+ let selectedResult = null;
+ let isExactMatch = false;
// Is the typed value exactly the same as the first result? Then show the
// appropiate icon instead of the generic search icon.
if ((results.length > 0) && (action.typedValue === results[0].value)) {
- [exactMatch] = results;
+ [selectedResult] = results;
+ isExactMatch = true;
results = results.splice(1);
}
@@ -41,7 +44,8 @@ const search = (state = DEFAULT_STATE, action) => {
...state,
input: action.typedValue,
results,
- exactMatch,
+ selectedResult,
+ isExactMatch,
};
}
default: