As a developer,
I want to connect to a MongoDB database and implement the ability to update and delete emotion types,
so that I can efficiently manage emotions across the application and maintain up-to-date information.
Description
Set up MongoDB connection to handle the update and delete functionality for emotion types.
Use useSWR on the frontend to manage real-time data fetching, so that when emotions are updated or deleted, the changes are reflected across the app dynamically.
Implement API routes to handle the CRUD operations (Update, Delete) and ensure proper handling of state changes across the app.
Acceptance criteria
[ ] What happens when an entry is empty?
[ ] How should something behave?
[ ] What is the text of an alert?
Tasks
[ ] Create a new branch: feature/backendCreateRead
[ ] Make sure you include the env.local file in git.ignore
[ ] Define a PUT API route and connect the submit handler of an edit form to this API route
[ ] Tell the submit handler of your edit form to use the PUT API route
[ ] Use the mutate method to update the component after a successful update
[ ] Define a DELETE API route and
connect a handler function which uses this API route
[ ] Tell the submit handler of your edit form to use the PUT API route
[ ] Add handler functions in both a general and a dynamic route with the methods PUT and DELETE
[ ] Write a handler function which calls fetch() with the appropriate arguments and pass it to a delete button
Value proposition
As a developer, I want to connect to a MongoDB database and implement the ability to update and delete emotion types, so that I can efficiently manage emotions across the application and maintain up-to-date information.
Description
Set up MongoDB connection to handle the update and delete functionality for emotion types. Use useSWR on the frontend to manage real-time data fetching, so that when emotions are updated or deleted, the changes are reflected across the app dynamically. Implement API routes to handle the CRUD operations (Update, Delete) and ensure proper handling of state changes across the app.
Acceptance criteria
Tasks
mutate
method to update the component after a successful update