Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 7119 Rev 7777
Línea 1... Línea 1...
1
import React, { useState } from 'react';
1
import React, { useState } from 'react';
2
import { Modal, Button } from 'react-bootstrap';
2
import { Modal, Button } from 'react-bootstrap';
3
import axios from 'axios';
3
import axios from 'axios';
-
 
4
import { addNotification } from '../../../redux/notification/notification.actions';
-
 
5
import { useDispatch } from 'react-redux';
Línea 4... Línea 6...
4
 
6
 
5
const SubmitModal = ({
7
const SubmitModal = ({
6
    children,
8
    children,
7
    closeModal = function () { },
9
    closeModal = function () { },
8
    postLink = '',
10
    postLink = '',
9
    submitData = '',
11
    submitData = '',
10
    title = ''
12
    title = ''
Línea 11... Línea 13...
11
}) => {
13
}) => {
-
 
14
 
Línea 12... Línea 15...
12
 
15
    const [error, setError] = useState('');
Línea 13... Línea 16...
13
    const [error, setError] = useState('');
16
    const dispatch = useDispatch()
14
 
17
 
Línea 20... Línea 23...
20
        })
23
        })
Línea 21... Línea 24...
21
 
24
 
22
        axios.post(postLink, formData)
25
        axios.post(postLink, formData)
23
            .then(({ data }) => {
26
            .then(({ data }) => {
-
 
27
                if (!data.success) {
-
 
28
                    dispatch(addNotification({
24
                if (!data.success) {
29
                        style: "error",
-
 
30
                        msg: Object.values(data.data)[0][0],
-
 
31
                    }))
25
                    return setError(Object.values(data.data)[0][0])
32
                    return
Línea -... Línea 33...
-
 
33
                }
-
 
34
 
-
 
35
 
26
                }
36
                dispatch(addNotification({
-
 
37
                    style: "success",
27
 
38
                    msg: Object.values(data.data)[0],
28
                console.log(data.data[0])
39
                }))
29
                setError(null)
40
                setError(null)
30
                closeModal()
41
                closeModal()
31
            })
42
            })