Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3520 Rev 3571
Línea 1... Línea 1...
1
import { useEffect, useState } from 'react';
1
import { useEffect, useState } from 'react';
Línea 2... Línea 2...
2
 
2
 
3
import { useAlert, useApi, useFetch } from '@shared/hooks';
3
import { useAlert, useApi, useFetch } from '@shared/hooks';
Línea 4... Línea 4...
4
import { markSlideCompleted } from '@microlearning/services';
4
import { markSlideCompleted } from '@microlearning/services';
5
 
5
 
Línea 6... Línea 6...
6
export function useSlide(topicUuid, slideUuid) {
6
export function useSlide(slideUuid) {
7
  const [slide, setSlide] = useState(null);
7
  const [slide, setSlide] = useState(null);
8
 
8
 
Línea 9... Línea 9...
9
  const { data, loading } = useFetch(`/microlearning/slides/${slideUuid}`);
9
  const { data, loading } = useFetch(`/microlearning/slides/${slideUuid}`);
10
  const { loading: markLoading, execute } = useApi(markSlideCompleted);
10
  const { loading: markLoading, execute } = useApi(markSlideCompleted);
11
  const { showSuccess, showError } = useAlert();
11
  const { showSuccess, showError } = useAlert();
12
 
12
 
13
  const handleMarkSlideCompleted = async () => {
13
  const handleMarkSlideCompleted = async () => {
14
    try {
14
    try {
15
      const message = await execute(`/microlearning/sync/topic/${topicUuid}/slide/${slideUuid}`);
15
      const message = await execute(`/microlearning/sync/slide/${slideUuid}`);
16
      setSlide({ ...slide, completed: true });
16
      setSlide({ ...slide, completed: true });