Skip to content

Commit

Permalink
fix(search): open url of the selected suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
trollepierre committed Aug 18, 2022
1 parent 7b7491d commit 1cf4e0a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/SearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,9 @@ class SearchBar extends Component {
// `onSelect` is a string that describes what should happen when the suggestion is selected. Currently, the only format we're supporting is `open:http://example.com` to change the url of the current page.

if (typeof onSelect === 'function') {
await onSelect()
window.location.href = `open:` + (await onSelect())
} else if (/^open:/.test(onSelect)) {
const url = onSelect.substr(5)
window.location.href = url
window.location.href = onSelect.substr(5)
} else {
// eslint-disable-next-line no-console
console.log(
Expand Down

0 comments on commit 1cf4e0a

Please sign in to comment.