Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 7538 Rev 7790
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import axios from 'axios';
2
import axios from 'axios';
3
import { Modal, Button } from 'react-bootstrap';
3
import { Modal, Button } from 'react-bootstrap';
4
import { useForm } from "react-hook-form";
4
import { useForm } from "react-hook-form";
5
import { useDispatch } from 'react-redux';
5
import { useDispatch } from 'react-redux';
-
 
6
import { addNotification } from '../redux/notification/notification.actions';
Línea 6... Línea 7...
6
 
7
 
7
const DeleteModal = ({
8
const DeleteModal = ({
8
    isOpen = false,
9
    isOpen = false,
9
    closeModal = function () { },
10
    closeModal = function () { },
10
    title = 'Estas seguro?',
11
    title = 'Estas seguro?',
11
    action,
12
    action,
12
    onComplete,
13
    onComplete,
-
 
14
    url,
13
    url
15
    message
Línea 14... Línea 16...
14
}) => {
16
}) => {
15
 
17
 
Línea 29... Línea 31...
29
            .then(async ({ data }) => {
31
            .then(async ({ data }) => {
30
                if (data.success) {
32
                if (data.success) {
31
                    try {
33
                    try {
32
                        action && dispatch(action())
34
                        action && dispatch(action())
33
                        onComplete && onComplete()
35
                        onComplete && onComplete()
-
 
36
                        dispatch(addNotification({
-
 
37
                            style: "success",
-
 
38
                            msg: message ? message : 'Eliminado correctamente'
-
 
39
                        }))
Línea 34... Línea 40...
34
 
40
 
35
                        closeModal()
41
                        closeModal()
36
                    }
42
                    }
-
 
43
                    catch (err) { dispatch(addNotification({
-
 
44
                        style: "error",
-
 
45
                        msg: "Ha ocurrido un error"
37
                    catch (err) { console.log(err) }
46
                    })) }
38
                }
47
                }
39
            })
48
            })
40
            .catch((err) => console.log(err))
49
            .catch((err) => console.log(err))