Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1923 Rev 1924
Línea 1... Línea 1...
1
import React, { useCallback, useState, useEffect } from 'react'
1
import React, { useCallback, useState } from 'react'
2
import { useSelector } from 'react-redux'
2
import { useSelector } from 'react-redux'
3
import { Box } from '@mui/material'
3
import { Box } from '@mui/material'
4
import BootstrapModal from 'react-bootstrap/Modal'
4
import BootstrapModal from 'react-bootstrap/Modal'
Línea 5... Línea 5...
5
 
5
 
Línea 27... Línea 27...
27
  children
27
  children
28
}) => {
28
}) => {
29
  const [loading, setLoading] = useState(false)
29
  const [loading, setLoading] = useState(false)
30
  const labels = useSelector(({ intl }) => intl.labels)
30
  const labels = useSelector(({ intl }) => intl.labels)
Línea 31... Línea 31...
31
 
31
 
32
  const handleAccept = useCallback(() => {
32
  const handleAccept = useCallback(async () => {
Línea 33... Línea 33...
33
    const enableLoading = isPromise(onAccept)
33
    const enableLoading = isPromise(onAccept)
34
 
34
 
35
    if (enableLoading) {
-
 
36
      setLoading(true)
-
 
37
      onAccept().finally(() => setLoading(false))
35
    if (enableLoading) setLoading(true)
38
    } else {
-
 
39
      onAccept()
36
    await onAccept()
Línea 40... Línea -...
40
    }
-
 
41
  }, [onAccept])
-
 
42
 
-
 
43
  useEffect(() => {
-
 
44
    if (!show && loading) setLoading(false)
37
    setLoading(false)
45
  }, [show, loading])
38
  }, [onAccept])
46
 
39
 
47
  return (
40
  return (
48
    <BootstrapModal
41
    <BootstrapModal