Skip to content

Commit bd69f14

Browse files
committed
refactor(account): use toast instead of redirect page for passkey deletion
Changed the passkey deletion behavior in account center: - After deleting a passkey, show a toast message instead of redirecting to a success page - This improves UX by keeping users on the passkey management page - Removed the unused passkeyDeletedRoute and related code
1 parent eb6b5e2 commit bd69f14

File tree

22 files changed

+23
-87
lines changed

22 files changed

+23
-87
lines changed

packages/account/src/App.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
passkeyAddRoute,
3232
passkeyManageRoute,
3333
passkeySuccessRoute,
34-
passkeyDeletedRoute,
3534
} from './constants/routes';
3635
import initI18n from './i18n/init';
3736
import BackupCodeBinding from './pages/BackupCodeBinding';
@@ -106,10 +105,6 @@ const Main = () => {
106105
element={<UpdateSuccess identifierType="backup_code" />}
107106
/>
108107
<Route path={passkeySuccessRoute} element={<UpdateSuccess identifierType="passkey" />} />
109-
<Route
110-
path={passkeyDeletedRoute}
111-
element={<UpdateSuccess identifierType="passkey_deleted" />}
112-
/>
113108
<Route path={emailRoute} element={<Email />} />
114109
<Route path={phoneRoute} element={<Phone />} />
115110
<Route path={passwordRoute} element={<Password />} />

packages/account/src/constants/routes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ export const backupCodesSuccessRoute = '/backup-codes/success';
1414
export const passkeyAddRoute = '/passkey/add';
1515
export const passkeyManageRoute = '/passkey/manage';
1616
export const passkeySuccessRoute = '/passkey/success';
17-
export const passkeyDeletedRoute = '/passkey/deleted';

packages/account/src/pages/PasskeyView/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getMfaVerifications, deleteMfaVerification, updateWebAuthnName } from '
1717
import ConfirmModal from '@ac/components/ConfirmModal';
1818
import ErrorPage from '@ac/components/ErrorPage';
1919
import VerificationMethodList from '@ac/components/VerificationMethodList';
20-
import { passkeyDeletedRoute, passkeyAddRoute } from '@ac/constants/routes';
20+
import { passkeyAddRoute } from '@ac/constants/routes';
2121
import useApi from '@ac/hooks/use-api';
2222
import useErrorHandler from '@ac/hooks/use-error-handler';
2323
import SecondaryPageLayout from '@ac/layouts/SecondaryPageLayout';
@@ -102,12 +102,12 @@ const PasskeyView = () => {
102102
return;
103103
}
104104

105+
setPasskeys((previous) => previous?.filter((passkey) => passkey.id !== selectedPasskey.id));
105106
setShowDeleteConfirm(false);
106-
void navigate(passkeyDeletedRoute, { replace: true });
107+
setToast(t('account_center.passkey.deleted'));
107108
}, [
108109
deletePasskeyRequest,
109110
handleError,
110-
navigate,
111111
selectedPasskey,
112112
setToast,
113113
setVerificationId,

packages/account/src/pages/UpdateSuccess/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ type IdentifierType =
1111
| 'password'
1212
| 'totp'
1313
| 'backup_code'
14-
| 'passkey'
15-
| 'passkey_deleted';
14+
| 'backup_code_deleted'
15+
| 'passkey';
1616

1717
type TranslationMap = Partial<
1818
Record<IdentifierType, { readonly titleKey: TFuncKey; readonly messageKey: TFuncKey }>
@@ -49,10 +49,6 @@ const translationMap: TranslationMap = {
4949
titleKey: 'account_center.update_success.passkey.title',
5050
messageKey: 'account_center.update_success.passkey.description',
5151
},
52-
passkey_deleted: {
53-
titleKey: 'account_center.update_success.passkey_deleted.title',
54-
messageKey: 'account_center.update_success.passkey_deleted.description',
55-
},
5652
default: {
5753
titleKey: 'account_center.update_success.default.title',
5854
messageKey: 'account_center.update_success.default.description',

packages/phrases-experience/src/locales/ar/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ const account_center = {
141141
title: 'تمت إضافة مفتاح المرور!',
142142
description: 'تم ربط مفتاح المرور بحسابك بنجاح.',
143143
},
144-
passkey_deleted: {
145-
title: 'تم حذف مفتاح المرور!',
146-
description: 'تم حذف مفتاح المرور من حسابك.',
147-
},
148144
},
149145
backup_code: {
150146
title: 'رموز النسخ الاحتياطي',
@@ -161,6 +157,7 @@ const account_center = {
161157
never_used: 'أبدًا',
162158
unnamed: 'مفتاح مرور بدون اسم',
163159
renamed: 'تم تغيير اسم مفتاح المرور بنجاح.',
160+
deleted: 'تم حذف مفتاح المرور بنجاح.',
164161
add_another_title: 'إضافة مفتاح مرور آخر',
165162
add_another_description:
166163
'قم بتسجيل مفتاح المرور الخاص بك باستخدام المقاييس الحيوية للجهاز أو مفاتيح الأمان (مثل YubiKey) أو الطرق الأخرى المتاحة.',

packages/phrases-experience/src/locales/de/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ const account_center = {
155155
title: 'Passkey hinzugefügt!',
156156
description: 'Ihr Passkey wurde erfolgreich mit Ihrem Konto verknüpft.',
157157
},
158-
passkey_deleted: {
159-
title: 'Passkey entfernt!',
160-
description: 'Ihr Passkey wurde von Ihrem Konto entfernt.',
161-
},
162158
social: {
163159
title: 'Soziales Konto verknüpft!',
164160
description: 'Ihr soziales Konto wurde erfolgreich verknüpft.',
@@ -179,6 +175,7 @@ const account_center = {
179175
never_used: 'Nie',
180176
unnamed: 'Unbenannter Passkey',
181177
renamed: 'Passkey erfolgreich umbenannt.',
178+
deleted: 'Passkey erfolgreich entfernt.',
182179
add_another_title: 'Weiteren Passkey hinzufügen',
183180
add_another_description:
184181
'Registrieren Sie Ihren Passkey mit Geräte-Biometrie, Sicherheitsschlüsseln (z.B. YubiKey) oder anderen verfügbaren Methoden.',

packages/phrases-experience/src/locales/en/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ const account_center = {
144144
title: 'Passkey added!',
145145
description: 'Your passkey has been successfully linked to your account.',
146146
},
147-
passkey_deleted: {
148-
title: 'Passkey removed!',
149-
description: 'Your passkey has been removed from your account.',
150-
},
151147
social: {
152148
title: 'Social account linked!',
153149
description: 'Your social account has been successfully linked.',
@@ -168,6 +164,7 @@ const account_center = {
168164
never_used: 'Never',
169165
unnamed: 'Unnamed passkey',
170166
renamed: 'Passkey renamed successfully.',
167+
deleted: 'Passkey removed successfully.',
171168
add_another_title: 'Add another passkey',
172169
add_another_description:
173170
'Register your passkey using device biometrics, security keys (e.g., YubiKey), or other available methods.',

packages/phrases-experience/src/locales/es/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ const account_center = {
150150
title: '¡Passkey añadido!',
151151
description: 'Tu passkey se ha vinculado correctamente a tu cuenta.',
152152
},
153-
passkey_deleted: {
154-
title: '¡Passkey eliminado!',
155-
description: 'Tu passkey ha sido eliminado de tu cuenta.',
156-
},
157153
social: {
158154
title: '¡Cuenta social vinculada!',
159155
description: 'Tu cuenta social ha sido vinculada exitosamente.',
@@ -174,6 +170,7 @@ const account_center = {
174170
never_used: 'Nunca',
175171
unnamed: 'Passkey sin nombre',
176172
renamed: 'Passkey renombrado correctamente.',
173+
deleted: 'Passkey eliminado correctamente.',
177174
add_another_title: 'Añadir otro passkey',
178175
add_another_description:
179176
'Registra tu passkey usando biometría del dispositivo, llaves de seguridad (ej. YubiKey) u otros métodos disponibles.',

packages/phrases-experience/src/locales/fr/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ const account_center = {
154154
title: 'Passkey ajouté !',
155155
description: 'Votre passkey a été lié avec succès à votre compte.',
156156
},
157-
passkey_deleted: {
158-
title: 'Passkey supprimé !',
159-
description: 'Votre passkey a été supprimé de votre compte.',
160-
},
161157
},
162158
backup_code: {
163159
title: 'Codes de secours',
@@ -174,6 +170,7 @@ const account_center = {
174170
never_used: 'Jamais',
175171
unnamed: 'Passkey sans nom',
176172
renamed: 'Passkey renommé avec succès.',
173+
deleted: 'Passkey supprimé avec succès.',
177174
add_another_title: 'Ajouter un autre passkey',
178175
add_another_description:
179176
"Enregistrez votre passkey à l'aide de la biométrie de l'appareil, des clés de sécurité (ex. YubiKey) ou d'autres méthodes disponibles.",

packages/phrases-experience/src/locales/it/account-center.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ const account_center = {
152152
title: 'Passkey aggiunto!',
153153
description: 'Il tuo passkey è stato collegato con successo al tuo account.',
154154
},
155-
passkey_deleted: {
156-
title: 'Passkey rimosso!',
157-
description: 'Il tuo passkey è stato rimosso dal tuo account.',
158-
},
159155
},
160156
backup_code: {
161157
title: 'Codici di backup',
@@ -172,6 +168,7 @@ const account_center = {
172168
never_used: 'Mai',
173169
unnamed: 'Passkey senza nome',
174170
renamed: 'Passkey rinominato con successo.',
171+
deleted: 'Passkey rimosso con successo.',
175172
add_another_title: 'Aggiungi un altro passkey',
176173
add_another_description:
177174
'Registra il tuo passkey utilizzando la biometria del dispositivo, le chiavi di sicurezza (es. YubiKey) o altri metodi disponibili.',

0 commit comments

Comments
 (0)