Create a "/delete-profile" endpoint that takes a Principal as a parameter.
Create a deleteProfile() method in the UserService that takes a String as a parameter.
Override the deleteProfile() method in the UserServiceImpl (here it's where the profile deletion is implemented).
FrontEnd:
Create a deleteProfile fuction in the HttpClients.ts file to send a HTTP DELETE Request on the "/delete-profile" endpoint.
Create a ProfileDeletion.tsx file inside there is the HandleDeletion funtion that handles an event (the profile deletion). Basically it sends a delete request through the deleteProfile() fuction in the HttpClients.ts file, then calls "logout()" from usePetClinicState to clear user's session by setting the token and user to Null and redirects to the main page, and because there is no a user authenticated, only the "Login" and "Register" links are visible.
If for some reason it's not possible to delete the profile, the "Unable to delete profile" message will be display on the page.
SCRUM-70: Create the delete endpoint
Backend:
Create a "/delete-profile" endpoint that takes a Principal as a parameter.
Create a deleteProfile() method in the UserService that takes a String as a parameter.
Override the deleteProfile() method in the UserServiceImpl (here it's where the profile deletion is implemented).
FrontEnd:
Create a deleteProfile fuction in the HttpClients.ts file to send a HTTP DELETE Request on the "/delete-profile" endpoint.
Create a ProfileDeletion.tsx file inside there is the HandleDeletion funtion that handles an event (the profile deletion). Basically it sends a delete request through the deleteProfile() fuction in the HttpClients.ts file, then calls "logout()" from usePetClinicState to clear user's session by setting the token and user to Null and redirects to the main page, and because there is no a user authenticated, only the "Login" and "Register" links are visible.
If for some reason it's not possible to delete the profile, the "Unable to delete profile" message will be display on the page.