Skip to content
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

Wrong API endpoints used for updating recipes from Vue #1073

Closed
christianlupus opened this issue Jul 6, 2022 · 3 comments · Fixed by #1119
Closed

Wrong API endpoints used for updating recipes from Vue #1073

christianlupus opened this issue Jul 6, 2022 · 3 comments · Fixed by #1119
Assignees
Labels
bug Something isn't working Frontend Issue or PR related to the frontend code javascript Pull requests that update Javascript code

Comments

@christianlupus
Copy link
Collaborator

Currently there is a big in the Vue e frontend. Amy update on a recipe is directed to the engine for new recipes. This does work because the implementation in the backend are very similar. However, this should be fixed to prevent nasty bugs.

@christianlupus christianlupus added bug Something isn't working javascript Pull requests that update Javascript code Frontend Issue or PR related to the frontend code labels Jul 6, 2022
@MarcelRobitaille
Copy link
Collaborator

Maybe I'm not understanding something, but it looks to me that the save method of RecipeEdit is emitting updateRecipe if this.recipe_id is set and createRecipe otherwise: https://github.com/nextcloud/cookbook/blob/master/src/components/RecipeEdit.vue#L608. I tracked this down to src/store/index.js, where updateRecipe calls api.recipes.update and createRecipe calls api.recipes.create. The former does PUT to ${baseUrl}/api/recipes/${id} and the latter does POST to ${baseUrl}/api/recipes. It seems like two different endpoints to me, but again I could be getting something wrong.

@christianlupus
Copy link
Collaborator Author

That would be the theory. In reality, (most probably, I have not debugged here) the this,recipe_id is either null or not updated accordingly. As a result, the RecipeEdit component thinks the recipe is new while, it is an updated one.

It is just working E2E due to the similar implementations in the backend. Just have a look in the developer console when updating a recipe. You will not see a PUT but a POST request.

@MarcelRobitaille
Copy link
Collaborator

Sorry, I should have checked that as well. I should have tested it and looked for PUT or POST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Frontend Issue or PR related to the frontend code javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants