mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 19:31:14 -05:00
Refactor: Improve validation schemas
This commit is contained in:
@@ -60,19 +60,36 @@ export function SecurityTab() {
|
||||
};
|
||||
|
||||
const handleSocialLogin = async (provider: OAuthProvider) => {
|
||||
const result = await connectIdentity(provider, '/settings?tab=security');
|
||||
|
||||
if (!result.success) {
|
||||
try {
|
||||
const result = await connectIdentity(provider, '/settings?tab=security');
|
||||
|
||||
if (!result.success) {
|
||||
// Handle rate limiting
|
||||
if (result.error?.includes('rate limit')) {
|
||||
toast({
|
||||
title: 'Too Many Attempts',
|
||||
description: 'Please wait a few minutes before trying again.',
|
||||
variant: 'destructive'
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
title: 'Connection Failed',
|
||||
description: result.error,
|
||||
variant: 'destructive'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toast({
|
||||
title: 'Redirecting...',
|
||||
description: `Connecting your ${provider} account...`
|
||||
});
|
||||
}
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
title: 'Connection Failed',
|
||||
description: result.error,
|
||||
title: 'Connection Error',
|
||||
description: error.message || 'Failed to connect account',
|
||||
variant: 'destructive'
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
title: 'Redirecting...',
|
||||
description: `Connecting your ${provider} account...`
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user