summaryrefslogtreecommitdiffstats
path: root/src/features/auth
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/auth')
-rw-r--r--src/features/auth/hooks/useLogin.ts5
-rw-r--r--src/features/auth/hooks/useRegister.ts5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/features/auth/hooks/useLogin.ts b/src/features/auth/hooks/useLogin.ts
index 5e4c881..6af76c5 100644
--- a/src/features/auth/hooks/useLogin.ts
+++ b/src/features/auth/hooks/useLogin.ts
@@ -1,6 +1,7 @@
import { useState } from 'react';
import { router } from 'expo-router';
import { authService } from '@/features/auth/services/authService';
+import { getErrorMessage } from '@/shared/lib/errors/getErrorMessage';
export function useLogin() {
const [email, setEmail] = useState('');
@@ -19,8 +20,8 @@ export function useLogin() {
});
router.replace('/(protected)/home');
- } catch (err: any) {
- setError(err?.message ?? 'No se pudo iniciar sesión');
+ } catch (err) {
+ setError(getErrorMessage(err, 'No se pudo iniciar sesión'));
} finally {
setIsSubmitting(false);
}
diff --git a/src/features/auth/hooks/useRegister.ts b/src/features/auth/hooks/useRegister.ts
index 7b93e92..fe83d85 100644
--- a/src/features/auth/hooks/useRegister.ts
+++ b/src/features/auth/hooks/useRegister.ts
@@ -1,6 +1,7 @@
import { useState } from 'react';
import { router } from 'expo-router';
import { authService } from '@/features/auth/services/authService';
+import { getErrorMessage } from '@/shared/lib/errors/getErrorMessage';
export function useRegister() {
const [displayName, setDisplayName] = useState('');
@@ -21,8 +22,8 @@ export function useRegister() {
});
router.replace('/(protected)/home');
- } catch (err: any) {
- setError(err?.message ?? 'No se pudo registrar el usuario');
+ } catch (err) {
+ setError(getErrorMessage(err, 'No se pudo registrar el usuario'));
} finally {
setIsSubmitting(false);
}