Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 7427 Rev 7476
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';
Línea 5... Línea 6...
5
 
6
 
6
const DeleteModal = ({
7
const DeleteModal = ({
7
    isOpen = false,
8
    isOpen = false,
8
    closeModal = function () { },
9
    closeModal = function () { },
9
    title = 'Estas seguro?',
10
    title = 'Estas seguro?',
10
    action,
11
    action,
11
    url,
12
    url,
Línea 12... Línea 13...
12
}) => {
13
}) => {
-
 
14
 
Línea 13... Línea 15...
13
 
15
    const { handleSubmit } = useForm();
14
    const { handleSubmit } = useForm();
16
    const dispatch = useDispatch();
15
 
17
 
16
    const onSubmit = () => {
18
    const onSubmit = () => {
Línea 17... Línea 19...
17
        if (!url) {
19
        if (!url) {
18
            return action()
20
            return dispatch(action())
19
        }
21
        }
20
 
22
 
21
        axios.post(url)
23
        axios.post(url)
Línea 22... Línea 24...
22
            .then(async ({ data }) => {
24
            .then(async ({ data }) => {
23
                if (data.success) {
25
                if (data.success) {
24
                    try {
26
                    try {
25
                        action && action()
27
                        action && dispatch(action())