0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-17 23:45:29 -05:00

refactor: navigate to selected package on enter key press (#1122)

This commit is contained in:
Ayush Sharma 2018-11-18 16:24:17 +01:00 committed by GitHub
parent 903bd0b091
commit c8939a2792
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,15 +217,10 @@ export default class App extends Component {
// eslint-disable-next-line no-unused-vars
handleClickSearch = (_, { suggestionValue, method }) => {
const { packages } = this.state;
switch(method) {
case 'click':
window.location.href = getDetailPageURL(suggestionValue);
break;
case 'enter':
this.setState({
filteredPackages: packages.filter(pkg => pkg.label.match(suggestionValue))
});
window.location.href = getDetailPageURL(suggestionValue);
break;
}
}