summaryrefslogtreecommitdiffstats
path: root/src/features/auth/hooks
diff options
context:
space:
mode:
authorAlberto Duarte Delgado <alberto@albertoduarte.com>2026-04-01 13:03:25 +0100
committerAlberto Duarte Delgado <alberto@albertoduarte.com>2026-04-01 13:03:25 +0100
commit08ce78dbd97ad792e163482f454f285557c7cdd0 (patch)
tree998ce8d7d48f8344d9ec34691809f2482cde5136 /src/features/auth/hooks
parentc927739f8f221feabb6e19af2c2667eda905a2eb (diff)
Mejoras de UX y feedback de errores; y, manejo de status de reserva
Diffstat (limited to 'src/features/auth/hooks')
-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);
}