Rev 3505 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import { useEffect, useState } from 'react';
import { useFetch } from '@hooks';
const DEFAULT_STATE = {
uuid: '',
name: '',
description: '',
image: '',
link_comments: '',
link_comment_add: '',
link_slides: '',
total_comments: '',
total_rating: '0',
progress: 0,
completed: 0,
total_slides: null,
link_first_slide: '',
type_first_slide: '',
order: null,
added_on: '',
updated_on: ''
};
export function useCapsule(uuid) {
const [capsule, setCapsule] = useState(DEFAULT_STATE);
const { data, isLoading: loading } = useFetch(`/microlearning/get-capsule/${uuid}`);
useEffect(() => {
if (data) setCapsule(data);
}, [data]);
return { capsule, loading };
}