diff --git a/frontend/src/components/user/profile/ProfilePasskeyCard.vue b/frontend/src/components/user/profile/ProfilePasskeyCard.vue index 0b60113d89..e52ffaf4a9 100644 --- a/frontend/src/components/user/profile/ProfilePasskeyCard.vue +++ b/frontend/src/components/user/profile/ProfilePasskeyCard.vue @@ -205,12 +205,18 @@ function extractErrorMessage(error: unknown, fallback: string): string { } async function loadCredentials(): Promise { + if (!props.enabled) { + credentials.value = [] + return + } loading.value = true try { credentials.value = await passkeyAPI.list() } catch (error) { - const code = (error as { code?: string }).code - if (code !== 'PASSKEY_DISABLED') { + // 字符串错误码在 reason 字段(code 是数字状态码); + // 设置变更竞态下后端仍可能返回 PASSKEY_DISABLED,静默处理 + const reason = (error as { reason?: string }).reason + if (reason !== 'PASSKEY_DISABLED') { appStore.showError(t('profile.passkey.loadFailed')) } } finally {