-
Couldn't load subscription status.
- Fork 10
Began working on Search functionality #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
[FIX]: Search screen now displays searches
app/helpers/api.js
Outdated
| * @return {Promise} Returns a promise | ||
| */ | ||
|
|
||
| const searchPost = (options = defaultSearchOptions, query='') => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does defaultSearchOptions come from?
app/helpers/api.js
Outdated
| const searchOptions = { | ||
| sortByDate: false || options.sortByDate, | ||
| pageNumber: 1 || options.pageNumber, | ||
| tags: 'story' || options.tag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these variables see my comments below:
const searchOptions = {
sortByDate: false || options.sortByDate, // will always be options.sortByDate or undefined as false || <anything> will always be <anything>
pageNumber: 1 || options.pageNumber, // will always be 1
tags: 'story' || options.tag, // will always be 'story`
}Better to do change the condition for all three, e.g: sortByDate: options.sortByDate || false
app/helpers/api.js
Outdated
| const queryParameter = `query=${query}`; | ||
| const tagParameter = `&tags=${searchOptions.tags}` | ||
|
|
||
| const searchUrl = `${config.apiSearch}${dateParameter}?${queryParameter}${hitsPerPage}${tagParameter}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change config. apiSearch to config.search once updated in config/default.json
app/config/default.json
Outdated
| @@ -1,5 +1,6 @@ | |||
| { | |||
| "api": "https://hacker-news.firebaseio.com/v0", | |||
| "apiSearch": "http://hn.algolia.com/api/v1/", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename apiSearch to search to fit in with api and base
|
Thanks for the contribution! I left a few comments. Are you planning on adding anymore? If not, I can merge after you've made the changes, otherwise i'll leave the PR open for a while longer so you can work on it |
[FIX]: Fixed searchOptions conditions [CHORE]: Added yarn.lock to .gitignore
|
Hi! I changed those things 👍 I plan on contributing a lot more, so we'll keep this open 💃 |
[CHORE]: Added packagelock.json to .gitignore
Hi! I really like the work that you've done.
I'm a bit new to contributing to OS, so sorry if you're only supposed to PR if you've fully completed the work. I began working on search functionality, its not close to 100% complete, but I'd love to create a branch for it and others can help work on it there.
Thanks!