mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 20:51:13 -05:00
Implement type safety and JSONB elimination
This commit is contained in:
@@ -5,7 +5,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { handleError, handleSuccess, handleInfo, AppError } from '@/lib/errorHandler';
|
||||
import { handleError, handleSuccess, handleInfo, AppError, getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
@@ -48,11 +48,11 @@ export function TOTPSetup() {
|
||||
updated_at: factor.updated_at
|
||||
}));
|
||||
setFactors(totpFactors);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch TOTP factors', {
|
||||
userId: user?.id,
|
||||
action: 'fetch_totp_factors',
|
||||
error: error.message
|
||||
error: getErrorMessage(error)
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -73,15 +73,15 @@ export function TOTPSetup() {
|
||||
setSecret(data.totp.secret);
|
||||
setFactorId(data.id);
|
||||
setEnrolling(true);
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('Failed to start TOTP enrollment', {
|
||||
userId: user?.id,
|
||||
action: 'totp_enroll_start',
|
||||
error: error.message
|
||||
error: getErrorMessage(error)
|
||||
});
|
||||
handleError(
|
||||
new AppError(
|
||||
error.message || 'Failed to start TOTP enrollment',
|
||||
getErrorMessage(error) || 'Failed to start TOTP enrollment',
|
||||
'TOTP_ENROLL_FAILED'
|
||||
),
|
||||
{ action: 'Start TOTP enrollment', userId: user?.id }
|
||||
@@ -146,17 +146,17 @@ export function TOTPSetup() {
|
||||
window.location.href = '/auth';
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
logger.error('TOTP verification failed', {
|
||||
userId: user?.id,
|
||||
action: 'totp_verify',
|
||||
error: error.message,
|
||||
error: getErrorMessage(error),
|
||||
factorId
|
||||
});
|
||||
|
||||
handleError(
|
||||
new AppError(
|
||||
error.message || 'Invalid verification code. Please try again.',
|
||||
getErrorMessage(error) || 'Invalid verification code. Please try again.',
|
||||
'TOTP_VERIFY_FAILED'
|
||||
),
|
||||
{ action: 'Verify TOTP code', userId: user?.id, metadata: { factorId } }
|
||||
|
||||
Reference in New Issue
Block a user