hunterwilkins2 / bulldog-books

An online bookstore for UGA CSCI 4050. Created with React and Node.
MIT License
2 stars 3 forks source link

Fix user having to manually update profile page when info is changed #52

Open hunterwilkins2 opened 3 years ago

hunterwilkins2 commented 3 years ago

I figured out how to filter the properties that get returned when you call mongoose's find. If I returned the json of the object, we would not have to call the get route again. I am wondering if you could automatically update the information in the profile form this way instead of forcing the user to manually update the profile information?

GaryBarnes13 commented 3 years ago

Hmmm, maybe. The issue is really that the page no longer refreshes upon form submission (preventDefault() is called under the hood), so that button literally just automatically refreshes the page. Where in the project has this find method changed, or is there some documentation I could look at for it? I was also looking at using the UseEffect hook to automatically refresh these forms, but since we got full credit for the page, I have not gotten around to it

hunterwilkins2 commented 3 years ago

Look at my pull request for manage employees. I am returning a json object of the user who got promoted or demoted. It is not the highest priority task, but we will run into the same issue on our manage users page and our cart page. So, we should probably figure something better than having a button to manually update the page on each of these pages.