mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 02:11:14 -05:00
Refactor: Update type safety status
This commit is contained in:
@@ -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.',
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user