appbrewery / api-example-secrets-api

22 stars 13 forks source link

Bug with put/patch/delete requests #1

Closed wenhan-lui closed 9 months ago

wenhan-lui commented 1 year ago

There is currently a bug where even though a record has been created by a user, the user is not able to put/patch/delete that specific new record (e.g. ID #52).

I suspect this is due to the placement of the "return false" statement in the users.js file for the updateRecord and deleteSecretWithId functions where the "return false" statement should be placed after the for loops (i.e. Line 51 to Line 52). Otherwise, it will "return false" on the first iteration as the username will definitely not match for the new user against the first item in the records array.

image

Moeed-Furqan commented 1 year ago

which means only the very first record can be changed or delete if and only if you are the first user , which is "user123", in the original piece of code. Am i right?

matsechterhoff commented 1 year ago

I cloned the repo and ran server as well as client side code locally on my machine. Changed API url, generated necessary Bearer Tokens etc. Everything including put, patch and delete works fine. I suspect there is already a fix but it isn't deployed yet on https://secrets-api.appbrewery.com.