Using FormData to make a GraphQL Request
function getRequestBodyWithUploadables(request, variables, uploadables) {
let formData = new FormData();
formData.append('query', request.text);
formData.append('variables', JSON.stringify(variables));
Object.keys(uploadables).forEach(key => {
if (Object.prototype.hasOwnProperty.call(uploadables, key)) {
formData.append(key, uploadables[key]);
}
});
return formData;
}