diff --git a/README.md b/README.md index ce4a054..6062b71 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Getting Dashboard to run is fairly simple and can be accomplished with two techn 1. Locally +Prerequisites: yarn, npm, node + ``` $ git clone https://github.com/phntxx/dashboard.git $ cd dashboard/ diff --git a/src/components/searchBar.js b/src/components/searchBar.js index e577d8e..57e4290 100644 --- a/src/components/searchBar.js +++ b/src/components/searchBar.js @@ -51,10 +51,12 @@ const SearchBar = () => { const handleSearchQuery = e => { var query = input; + console.log(query); + if (query.split(' ')[0].includes('/')) { handleQueryWithProvider(query); } else { - window.location = 'https://google.com/search?q=' + query; + //window.location = 'https://google.com/search?q=' + query; } e.preventDefault(); @@ -67,12 +69,16 @@ const SearchBar = () => { let searchQuery = queryArray.join(' '); + let providerFound = false; providers.forEach(provider => { - if (provider.prefix === prefix) + if (provider.prefix === prefix) { + providerFound = true; window.location = provider.url + searchQuery; + } }); - window.location = 'https://google.com/search?q=' + query; + if (!providerFound) + window.location = 'https://google.com/search?q=' + query; }; return (