Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1913 Rev 1914
Línea 1... Línea 1...
1
import React, { useState } 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 = () => {
32
  const handleAccept = useCallback(() => {
Línea 33... Línea 33...
33
    const enableLoading = isPromise(onAccept)
33
    const enableLoading = isPromise(onAccept)
34
 
34
 
35
    if (enableLoading) {
35
    if (enableLoading) {
36
      setLoading(true)
-
 
37
      onAccept().finally(() => {
-
 
38
        console.log(loading)
-
 
39
        setLoading(false)
36
      setLoading(true)
40
      })
37
      onAccept().finally(() => setLoading(false))
41
    } else {
38
    } else {
42
      onAccept()
39
      onAccept()
Línea 43... Línea 40...
43
    }
40
    }
44
  }
41
  }, [onAccept, setLoading])
45
 
42
 
46
  return (
43
  return (