Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit c8f9299

Browse files
committed
Merge pull request #322 from quran/fix-auto-complete
Autocomplete pointing to v2 suggest
2 parents 2acaf1e + 394403e commit c8f9299

File tree

1 file changed

+4
-6
lines changed
  • src/components/SearchAutocomplete

1 file changed

+4
-6
lines changed

src/components/SearchAutocomplete/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const client = new ApiClient();
88
const styles = require('./style.scss');
99

1010
@connect(
11-
(state, ownProps) => {
11+
state => {
1212
const surahs = state.surahs.entities;
1313
const surahId = state.surahs.current;
1414
let lang = 'en';
@@ -30,9 +30,8 @@ const styles = require('./style.scss');
3030
surahs,
3131
lang
3232
};
33-
}, {
34-
push
35-
}
33+
},
34+
{ push }
3635
)
3736
export default class SearchAutocomplete extends Component {
3837
constructor() {
@@ -107,7 +106,7 @@ export default class SearchAutocomplete extends Component {
107106
if (this.cached[lang][value]) {
108107
this.setState({ ayat: this.cached[lang][value] });
109108
} else {
110-
client.get('/suggest', {params: {q: value, l:lang}}).then((res) => {
109+
client.get('/v2/suggest', {params: {q: value, l: lang}}).then((res) => {
111110
this.cached[lang][value] = res;
112111

113112
if (this.props.value.trim() === value) {
@@ -181,7 +180,6 @@ export default class SearchAutocomplete extends Component {
181180
}
182181

183182
renderList(key) {
184-
//this.handleItemKeyDown.bind({ item, self: this })
185183
return this.state[key].map((item) => (
186184
<li key={item.href} tabIndex="0" onKeyDown={((event) => { this.handleItemKeyDown.call(this, event, item); }).bind(this)}>
187185
<div className={styles.link}>

0 commit comments

Comments
 (0)