Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 7476 Rev 7498
Línea 7... Línea 7...
7
const DeleteModal = ({
7
const DeleteModal = ({
8
    isOpen = false,
8
    isOpen = false,
9
    closeModal = function () { },
9
    closeModal = function () { },
10
    title = 'Estas seguro?',
10
    title = 'Estas seguro?',
11
    action,
11
    action,
-
 
12
    onComplete,
12
    url,
13
    url,
13
}) => {
14
}) => {
Línea 14... Línea 15...
14
 
15
 
15
    const { handleSubmit } = useForm();
16
    const { handleSubmit } = useForm();
Línea 16... Línea 17...
16
    const dispatch = useDispatch();
17
    const dispatch = useDispatch();
17
 
18
 
18
    const onSubmit = () => {
19
    const onSubmit = () => {
19
        if (!url) {
20
        if (!url && action) {
Línea -... Línea 21...
-
 
21
            return dispatch(action())
-
 
22
        }
-
 
23
 
-
 
24
        if (!url && onComplete) {
20
            return dispatch(action())
25
            return onComplete()
21
        }
26
        }
22
 
27
 
23
        axios.post(url)
28
        axios.post(url)
24
            .then(async ({ data }) => {
29
            .then(async ({ data }) => {
-
 
30
                if (data.success) {
Línea 25... Línea 31...
25
                if (data.success) {
31
                    try {
26
                    try {
32
                        action && dispatch(action())
27
                        action && dispatch(action())
33
                        onComplete && onComplete()
28
 
34