Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3503 | Rev 3512 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3503 Rev 3511
Línea 41... Línea 41...
41
export function useMicrolearning() {
41
export function useMicrolearning() {
42
  const [category, setCategory] = useState(CAPSULES_CATEGORIES[0].value);
42
  const [category, setCategory] = useState(CAPSULES_CATEGORIES[0].value);
43
  const capsulesRoutes = useRef(CAPSULES_ROUTES);
43
  const capsulesRoutes = useRef(CAPSULES_ROUTES);
44
  const capsuleCategories = useRef(CAPSULES_CATEGORIES);
44
  const capsuleCategories = useRef(CAPSULES_CATEGORIES);
Línea 45... Línea -...
45
 
-
 
46
  const {
45
 
-
 
46
  const { searchTerm, handleSearch } = useSearch();
47
    data: capsules,
47
 
48
    loading: capsulesLoading,
-
 
49
    searchTerm,
-
 
50
    handleSearch
48
  const { data: capsules, loading: capsulesLoading } = useFetch(
51
  } = useSearch(capsulesRoutes.current[category].link, {
49
    capsulesRoutes.current[category].link,
52
    initialParams: capsulesRoutes.current[category].params
50
    { initialParams: capsulesRoutes.current[category].params }
Línea 53... Línea 51...
53
  });
51
  );
54
 
52
 
55
  const { data: currentCapsule, loading: currentCapsuleLoading } = useFetch(
53
  const { data: currentCapsule, loading: currentCapsuleLoading } = useFetch(
Línea -... Línea 54...
-
 
54
    '/microlearning/last-capsule-in-progress'
-
 
55
  );
-
 
56
 
-
 
57
  const filteredCapsules =
56
    '/microlearning/last-capsule-in-progress'
58
    capsules?.filter((capsule) => capsule.name.toLowerCase().includes(searchTerm.toLowerCase())) ||
57
  );
59
    [];
58
 
60
 
Línea 59... Línea 61...
59
  const changeCategory = (value) => {
61
  const changeCategory = (value) => {
60
    setCategory(value);
62
    setCategory(value);
61
  };
63
  };
62
 
64
 
63
  return {
65
  return {
64
    capsules,
66
    capsules: filteredCapsules,
65
    currentCapsule,
67
    currentCapsule,