{"size": 872, "ext": "js", "max_stars_repo_path": "src/utils/Uploader.js", "max_stars_repo_name": "AlySystem/alyskiper_support_v2", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/utils/Uploader.js", "max_issues_repo_name": "AlySystem/alyskiper_support_v2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/utils/Uploader.js", "max_forks_repo_name": "AlySystem/alyskiper_support_v2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.0689655172, "max_line_length": 84, "alphanum_fraction": 0.5642201835}
const UPLOAD_ENDPOINT = 'https://upload-files-alysystem.herokuapp.com/uploads/file'

const uploadFile = (file, name) => {
    return new Promise((resolve, reject) => {
        var myHeaders = new Headers();
        myHeaders.append("Content-Type", "multipart/form-data");

        var formdata = new FormData();
        formdata.append("image", file, file.name);

        var requestOptions = {
            method: 'POST',
            //headers: myHeaders,
            body: formdata,
            redirect: 'follow'
        };

        console.log(requestOptions)

        fetch(UPLOAD_ENDPOINT, requestOptions)
            .then(response => response.text())
            .then(result => { console.log(result); resolve(result); })
            .catch(error => { console.log('error', error); reject(error) });

    })

}

export default uploadFile