Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2772 Rev 2773
Línea 10... Línea 10...
10
const MessageBox = ({ onSend, backendVars, sendLink }) => {
10
const MessageBox = ({ onSend, backendVars, sendLink }) => {
Línea 11... Línea 11...
11
 
11
 
12
    const fileInputEl = useRef(null);
12
    const fileInputEl = useRef(null);
13
    const [text, setText] = useState('')
13
    const [text, setText] = useState('')
-
 
14
    const [selectedFile, setSelectedFile] = useState("");
Línea 14... Línea 15...
14
    const [selectedFile, setSelectedFile] = useState("");
15
    const dispatch = useDispatch()
15
 
16
 
16
    const handleUploadFile = (e) => {
17
    const handleUploadFile = (e) => {
17
        const file = e.target.files[0];
18
        const file = e.target.files[0];
Línea 27... Línea 28...
27
    const handleSendFile = () => {
28
    const handleSendFile = () => {
28
        const formData = new FormData();
29
        const formData = new FormData();
29
        formData.append("file", selectedFile);
30
        formData.append("file", selectedFile);
Línea 30... Línea 31...
30
 
31
 
31
        axios.post(sendLink, formData)
32
        axios.post(sendLink, formData)
32
            .then(async (response) => {
-
 
33
                const resData = response.data;
33
            .then(({ data }) => {
34
                if (!resData.success) {
34
                if (!data.success) {
35
                    return useDispatch(addNotification({
35
                    return dispatch(addNotification({
36
                        style: "danger",
36
                        style: "danger",
37
                        msg: "Ha ocurrido un error"
37
                        msg: "Ha ocurrido un error"
38
                    }))
38
                    }))
39
                }
39
                }