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

Created Modal in ProfileForm.tsx, added profile deletion from firebas… #230

Merged
merged 8 commits into from
Jun 9, 2024

Conversation

dvala041
Copy link
Contributor

@dvala041 dvala041 commented Apr 14, 2024

H1 Account-Deletion-FullStack

Summary

Closes #207

  1. Created changeUserStatus function in ProfileForm.tsx which makes a call to /users/:userid endpoint to delete user from prisma and firebase databases (added ability to delete from firebase database in views.ts)
  2. Created a Modal for deleting account in ProfileForm.tsx; when account is deleted the user's session ends, they are rerouted to login page and their account is deleted

Testing

  1. Created dummy accounts to test the endpoint on postman and then on our local code

Notes

  1. Akin noted the importance of having the prisma and firebase deletion in the same promise

…e functionality to deleteUser endpoint in views.tsx and created a BigRed Variety for buttons in Button.tsx
@dvala041 dvala041 requested a review from jasozh as a code owner April 14, 2024 03:51
Copy link

vercel bot commented Apr 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lagos-volunteers ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2024 0:12am

Copy link
Member

@akinfelami akinfelami left a comment

Choose a reason for hiding this comment

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

Hi guys, great work on this!

I have added a few comments that need addressing. Please check them out and let me know if there are any questions

},
retry: false,
onSuccess: () => {
console.log("DELETED");
Copy link
Member

Choose a reason for hiding this comment

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

remove log

} = useForm<DeleteAccountFormValues>();

//changeUserStatus handles deleting user from prisma and firebase
const { mutateAsync: changeUserStatus, error: changeUserStatusError } =
Copy link
Member

Choose a reason for hiding this comment

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

You should use appropriate naming patterns. I don't think changeUserStatus is the way

Comment on lines 100 to 101
await changeUserStatus();
await handleSignOut();
Copy link
Member

Choose a reason for hiding this comment

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

Wrap this in a try catch, it is possible that it fails and the user will need some feedback that the action failed

Comment on lines 265 to 275
// const { mutateAsync: changeUserStatus } = useMutation({
// mutationFn: async () => {
// const { data } = await api.delete(`/users/${userid}`);
// return data;
// },
// retry: false,
// onSuccess: () => {
// console.log("DELETED");
// }
// });

Copy link
Member

Choose a reason for hiding this comment

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

remove comments

frontend/src/components/organisms/ProfileForm.tsx Outdated Show resolved Hide resolved
@jasozh jasozh merged commit 949b53a into main Jun 9, 2024
2 of 5 checks passed
@jasozh jasozh deleted the account-deletion-fullstack branch June 9, 2024 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved @jason it's good to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile account deletion (fullstack)
5 participants