Ajout moyen de pouvoir supprimer son compte#148
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the client-side “delete my account” flow in the account settings screen by wiring a new DELETE API call to a React Query mutation and exposing it via a confirmation dialog button.
Changes:
- Add
deleteAccountAPI endpoint and route constant for a DELETE/newf/merequest. - Introduce
useDeleteAccounthook that deletes the account then logs the user out. - Add
DeleteAccountButtonwith a confirmation dialog and new i18n strings across locales. - (Also includes broad dependency version changes in
package.json/package-lock.json.)
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/account/useDeleteAccount.ts | React Query mutation for account deletion + logout on success |
| src/components/custom/DeleteAccountButton.tsx | UI button + confirmation dialog calling the mutation |
| src/app/screens/account/settings/Settings.tsx | Adds the delete account button to settings screen |
| src/api/endpoints/user/user.endpoints.ts | Adds deleteAccount() API helper |
| src/api/common/endpoints.ts | Adds deleteAccount route constant |
| locales/*/translation.json | Adds settings.deleteAccount.* strings |
| package.json | Updates many dependencies (unrelated to feature) |
| package-lock.json | Lockfile churn matching dependency changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| title={t("settings.deleteAccount.title")} | ||
| className="gap-2" | ||
| cancelLabel={t("common.cancel")} | ||
| confirmLabel={t("settings.deleteAccount.confirm")} |
There was a problem hiding this comment.
DialogContent supports isPending and disableConfirm for the confirm button, but they aren’t wired here. With isPending true, the dialog confirm button remains clickable and can trigger multiple DELETE requests. Pass isPending={isPending} and disable confirm while pending (e.g. disableConfirm={isPending}), and consider also passing isPending so the confirm button shows its loading state.
| confirmLabel={t("settings.deleteAccount.confirm")} | |
| confirmLabel={t("settings.deleteAccount.confirm")} | |
| isPending={isPending} | |
| disableConfirm={isPending} |
| resendCode: "/auth/resend-code", | ||
| resetPassword: "/auth/reset-password", | ||
| changePassword: "/auth/change-password", | ||
| deleteAccount: "/newf/me", | ||
| club: "/club", |
There was a problem hiding this comment.
API_ROUTES.deleteAccount is identical to API_ROUTES.user (both "/newf/me"). This duplication can drift over time; consider reusing the existing user route for the delete call (or alias deleteAccount to user) rather than defining a separate constant with the same value.

On doit le faire avant le 14:
L'endpoint existe déjà côté back, juste à faire le côté client