Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6292 Rev 6293
Línea 6... Línea 6...
6
const FooterModal = ({ isOpen, closeModal, footerUploadUrl, action }) => {
6
const FooterModal = ({ isOpen, closeModal, footerUploadUrl, action }) => {
Línea 7... Línea 7...
7
 
7
 
8
    const { handleSubmit, register } = useForm()
8
    const { handleSubmit, register } = useForm()
Línea 9... Línea 9...
9
    const [error, setError] = useState();
9
    const [error, setError] = useState();
10
 
10
 
11
    const onSubmit = ({ footer }) => {
-
 
12
        const data = new FormData()
11
    const onSubmit = (data) => {
13
        data.append("footer", footer[0])
-
 
14
        axios.post(footerUploadUrl, data)
-
 
15
            .then(async ({ data }) => {
-
 
16
                if (!data.success) {
-
 
17
                    return setError(data.data)
-
 
18
                }
-
 
19
                action(data.data)
-
 
20
            })
-
 
21
            .then(() => {
-
 
22
                setError(null);
-
 
23
                closeModal()
-
 
24
            })
12
        console.log(data)
Línea 25... Línea 13...
25
            .catch(err => console.log(err))
13
        axios.post(footerUploadUrl, data)
26
    }
14
    }
27
 
15