Refactor: Update type safety status

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 17:19:19 +00:00
parent 81fccdc4d0
commit e580f1f4b4
21 changed files with 55 additions and 49 deletions

View File

@@ -213,7 +213,7 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
);
setStep('success');
} catch (error) {
} catch (error: unknown) {
const errorMsg = getErrorMessage(error);
logger.error('Email change failed', {
userId,
@@ -221,7 +221,12 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
error: errorMsg,
});
if (error.message?.includes('rate limit') || error.status === 429) {
const hasMessage = error instanceof Error || (typeof error === 'object' && error !== null && 'message' in error);
const hasStatus = typeof error === 'object' && error !== null && 'status' in error;
const errorMessage = hasMessage ? (error as { message: string }).message : '';
const errorStatus = hasStatus ? (error as { status: number }).status : 0;
if (errorMessage.includes('rate limit') || errorStatus === 429) {
handleError(
new AppError(
'Please wait a few minutes before trying again.',
@@ -230,7 +235,7 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
),
{ action: 'Change email', userId, metadata: { currentEmail, newEmail: data.newEmail } }
);
} else if (error.message?.includes('Invalid login credentials')) {
} else if (errorMessage.includes('Invalid login credentials')) {
handleError(
new AppError(
'The password you entered is incorrect.',

View File

@@ -50,7 +50,7 @@ export function EmailChangeStatus({
newEmailVerified: emailData.new_email_verified || false
});
}
} catch (error) {
} catch (error: unknown) {
handleError(error, { action: 'Check verification status' });
} finally {
setLoading(false);
@@ -77,7 +77,7 @@ export function EmailChangeStatus({
'Verification emails resent',
'Check your inbox for the verification links.'
);
} catch (error) {
} catch (error: unknown) {
handleError(error, { action: 'Resend verification emails' });
} finally {
setResending(false);

View File

@@ -81,7 +81,7 @@ export function PasswordUpdateDialog({ open, onOpenChange, onSuccess }: Password
const hasVerifiedTotp = data?.totp?.some(factor => factor.status === 'verified') || false;
setHasMFA(hasVerifiedTotp);
} catch (error) {
} catch (error: unknown) {
logger.error('Failed to check MFA status', {
action: 'check_mfa_status',
error: error instanceof Error ? error.message : String(error)