Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2749 Rev 2771
Línea 1... Línea 1...
1
import React, { useRef, useState } from 'react'
1
import React, { useRef, useState } from 'react'
2
import FileModal from '../../mobile-chat/mobile-chat/chat/fileModal/FileModal';
2
import FileModal from '../../mobile-chat/mobile-chat/chat/fileModal/FileModal';
3
import { axios } from '../../utils';
3
import { axios } from '../../utils';
4
import styles from "../../mobile-chat/mobile-chat/chat/chat.module.scss";
4
import styles from "../../mobile-chat/mobile-chat/chat/chat.module.scss";
-
 
5
import { addNotification } from '../../redux/notification/notification.actions';
-
 
6
import { useDispatch } from 'react-redux';
Línea 5... Línea 7...
5
 
7
 
Línea 6... Línea 8...
6
const permittedFiles = "video/mp4, video/mpeg, video/webm, application/pdf, image/jpeg, image/png, image/jpg";
8
const permittedFiles = "video/mp4, video/mpeg, video/webm, application/pdf, image/jpeg, image/png, image/jpg";
Línea 22... Línea 24...
22
        setSelectedFile("");
24
        setSelectedFile("");
23
    };
25
    };
Línea 24... Línea 26...
24
 
26
 
25
    const handleSendFile = () => {
27
    const handleSendFile = () => {
26
        const formData = new FormData();
28
        const formData = new FormData();
Línea 27... Línea 29...
27
        formData.append("message", selectedFile);
29
        formData.append("file", selectedFile);
28
 
30
 
29
        axios.post(sendLink, formData)
31
        axios.post(sendLink, formData)
30
            .then(async (response) => {
32
            .then(async (response) => {
-
 
33
                const resData = response.data;
31
                const resData = response.data;
34
                if (!resData.success) {
32
                if (resData.success) {
35
                    useDispatch(addNotification({
-
 
36
                        style: 'danger',
33
                    setSelectedFile("");
37
                        msg: 'Ha ocurrido un error'
-
 
38
                    }))
-
 
39
                }
34
                    setShowEmojione(false);
40
                setSelectedFile("");
35
                }
41
                setShowEmojione(false);
Línea 36... Línea 42...
36
            });
42
            });
37
    };
43
    };