-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
Todo example - getById() with String #26
Comments
Further investigation reveals that the get method should probably be receiving the id as a number, like update and remove does. |
Thanks for catching that! I changed the |
Upon a little further investigation I think the conversion needs to be done on the service level (for example with feathers-hooks) since in many cases the id isn't an actual number. Closing this issue but still open for other suggestions of course. |
Agreed. feathers-hooks to the rescue! |
* chore(package): update chai to version 4.0.2 Closes #24 * Use latest sinon-chai
* chore(package): update chai to version 4.0.2 Closes #26 * Use latest sinon-chai
* chore(package): update chai to version 4.0.2 Closes #24 * Use latest sinon-chai
* chore(package): update chai to version 4.0.2 Closes #26 * Use latest sinon-chai
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
I was playing around with the todo example and I found a little bug. When I try to access this url:
/todos/0
I get an error message sayingTodo not found
. (And I know there is a todo with id 0).I discovered that the
TodoStore.Get()
method receives the id as a string then passes it along to theTodoStore.getById()
method which compares the passed in id to the ids in the todos list using the===
operator. Since the ids stored in the todos list are numbers and do not match the type of the passed in string, the comparison fails.The get method is never used in the todos example, so it probably never showed up.
Some possible solutions are to convert the string to a number before passing it to
getById
or use the==
operator so that it will not check type as well.The text was updated successfully, but these errors were encountered: