summaryrefslogtreecommitdiffstats
path: root/src/features/offices/hooks/useOffices.ts
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/offices/hooks/useOffices.ts
parentc927739f8f221feabb6e19af2c2667eda905a2eb (diff)
Mejoras de UX y feedback de errores; y, manejo de status de reserva
Diffstat (limited to 'src/features/offices/hooks/useOffices.ts')
-rw-r--r--src/features/offices/hooks/useOffices.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/features/offices/hooks/useOffices.ts b/src/features/offices/hooks/useOffices.ts
index ff08f6c..99f8f8e 100644
--- a/src/features/offices/hooks/useOffices.ts
+++ b/src/features/offices/hooks/useOffices.ts
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { officesService } from '@/features/offices/services/officesService';
import { Office } from '@/features/offices/types';
+import { getErrorMessage } from '@/shared/lib/errors/getErrorMessage';
export function useOffices() {
const [offices, setOffices] = useState<Office[]>([]);
@@ -14,8 +15,8 @@ export function useOffices() {
const data = await officesService.getAll();
setOffices(data);
- } catch (err: any) {
- setError(err?.message ?? 'No se pudieron cargar los espacios');
+ } catch (err) {
+ setError(getErrorMessage(err, 'No se pudieron cargar los espacios'));
} finally {
setLoading(false);
}