Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7303 Rev 7305
Línea 7... Línea 7...
7
 
7
 
8
const EventModal = ({ event, show, onClose }) => {
8
const EventModal = ({ event, show, onClose }) => {
Línea 9... Línea 9...
9
  const dispatch = useDispatch()
9
  const dispatch = useDispatch()
-
 
10
 
-
 
11
  const getBackendVarUrl = () => {
10
 
12
    axios
11
  const getBackendVarUrl = () => {
13
      .get(event?.url)
Línea 12... Línea 14...
12
    axios.get(event?.url).then((response) => {
14
      .then((response) => {
-
 
15
        const { data, success } = response.data
-
 
16
 
-
 
17
        if (!success) {
-
 
18
          dispatch(
-
 
19
            addNotification({
-
 
20
              style: 'danger',
-
 
21
              msg: 'Error interno. Por favor, intente más tarde.',
-
 
22
            })
-
 
23
          )
-
 
24
          return
-
 
25
        }
-
 
26
 
13
      const { data, success } = response.data
27
        window.open(data, '_blank')
14
 
-
 
15
      if (!success) {
-
 
16
        dispatch(
28
      })
17
          addNotification({
-
 
18
            style: 'danger',
29
      .catch((error) => {
19
            msg: 'Error interno. Por favor, intente más tarde.',
30
        dispatch(
20
          })
31
          addNotification({ style: 'danger', message: 'Ha ocurrido un error' })
21
        )
-
 
22
        return
-
 
23
      }
-
 
24
 
32
        )
Línea 25... Línea 33...
25
      window.open(data, '_blank')
33
        throw new Error(error)
26
    })
34
      })
27
  }
35
  }
28
 
36
 
29
  return (
37
  return (
30
    <Modal show={show} onHide={onClose}>
38
    <Modal show={show} onHide={onClose}>
31
      <Modal.Header className="pb-0" closeButton>
39
      <Modal.Header className="pb-0" closeButton>
32
        <Modal.Title>{event?.title}</Modal.Title>
40
        <Modal.Title>{event?.title}</Modal.Title>
33
      </Modal.Header>
41
      </Modal.Header>
34
      <Modal.Body>
42
      <Modal.Body>
35
        <div
43
        <div
36
          className="cursor-pointer"
44
          className={event?.url && 'cursor-pointer'}
37
          onClick={event?.url && getBackendVarUrl}
45
          onClick={event?.url && getBackendVarUrl}