summaryrefslogtreecommitdiffstats
path: root/src/features/offices/hooks/useOffices.ts
diff options
context:
space:
mode:
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);
}