feat: Refactor carousel component and add new event card

- Updated ClientCarousel to accept props for dynamic image rendering.
- Changed CarouselProps interface to export for better type usage.
- Enhanced Carousel component to handle default images and improved styling.
- Introduced EventoCard component for displaying event details with dynamic data.
- Added MarkdownRenderer for rendering markdown content in EventoCard.
- Removed old Formulario component and replaced it with FormularioRegistro for better structure.
- Implemented prefetching logic in FormularioRegistro to auto-fill user data based on account info.
- Created PrefetchAbiertaCorta component for handling short answer questions with pre-filled data.
- Added useGetApi hook for simplified API data fetching.
- Updated plantillas data to include validation types for new form fields.
- Introduced new types for event and questionnaire handling in TypeScript.
- Enhanced styles for better UI/UX, including carousel controls and required field indicators.
This commit is contained in:
miguel
2025-06-16 18:25:12 -06:00
parent e275b33131
commit f00bd8ac5e
21 changed files with 2110 additions and 599 deletions
+31
View File
@@ -0,0 +1,31 @@
import axiosInstance from '@/utils/api-config';
import { getAxiosError } from '@/utils/errors-utils';
import { useEffect, useState } from 'react';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const useGetApi = <T,>(url: string, params?: Record<string, any>) => {
const [data, setData] = useState<T>();
const [loading, setLoading] = useState(true);
const [error, setError] = useState<ErrorState | null>(null);
useEffect(() => {
const fetchData = async () => {
try {
const res = await axiosInstance.get<T>(url, { params });
setData(res.data);
setError(null);
} catch (err) {
console.error(err);
const message = getAxiosError(err);
setError(message);
} finally {
setLoading(false);
}
};
fetchData();
}, [url, params]);
return { data, setData, loading, error };
};