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

Fix the endpoint used for updating recipes #1119

Conversation

MarcelRobitaille
Copy link
Collaborator

Fixes #1073

this.recipe_id is null, so use the recipe ID saved in the store.

I've tested it in the browsed. Where I was seeing POST before, I am now seeing PUT.

`this.recipe_id` is null, so use the recipe ID saved in the store

Signed-off-by: Marcel Robitaille <mail@marcelrobitaille.me>
Signed-off-by: Marcel Robitaille <mail@marcelrobitaille.me>
@MarcelRobitaille MarcelRobitaille force-pushed the 1073-fix-endpoint-recipe-update branch from 1262569 to 655c7f9 Compare July 26, 2022 19:25
@github-actions
Copy link

github-actions bot commented Jul 26, 2022

Unit Test Results

     36 files       36 suites   10m 38s ⏱️
   403 tests    403 ✔️ 0 💤 0
4 836 runs  4 836 ✔️ 0 💤 0

Results for commit 273de1e.

♻️ This comment has been updated with latest results.

@christianlupus christianlupus added this to the Release 0.9.14 milestone Jul 27, 2022
@christianlupus
Copy link
Collaborator

Hey. I just tried it and now everything gets done via PUT. A new recipe is created via PUT on /apps/cookbook/api/recipes/0.

Maybe you can have a second look.

Signed-off-by: Marcel Robitaille <mail@marcelrobitaille.me>
@MarcelRobitaille
Copy link
Collaborator Author

There I go being impatient again. Sorry about that. I think I got it now. I saw that line if (this.$route.params.id) elsewhere in the code. I actually tested it in both cases this time too. I got PUT for update and POST for create. BTW, I think if id can be 0, we should do the test if (this.$route.params.id ?? false). This is checking that it's not null and not undefined, but can be 0, empty string, etc.

@christianlupus
Copy link
Collaborator

I think all databases use a positive integer as primary key. Thus, it should work. For MySQL i am pretty sure and PostgreSQL i think all well. Only SQLite might cause trouble.

We can however ignore that. The id is the id of the parent folder at the moment. This parent folder will never be the very first entry in the list of notes present in the cloud. The skeleton files are created earlier. Thus, we can suspect them to be largen than 0.

Copy link
Collaborator

@christianlupus christianlupus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christianlupus christianlupus merged commit 3e70f56 into nextcloud:master Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong API endpoints used for updating recipes from Vue
2 participants