Skip to content

Commit

Permalink
Remove connection, loop through fields instead
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Jun 4, 2020
1 parent 5d2c59a commit 32314d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
12 changes: 9 additions & 3 deletions src/dapps/ManageENS/ManageENS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@ export default {
}
},
async uploadFile(file) {
const formData = new FormData();
this.ipfsProcessing = true;
try {
const content = await fetch(
Expand All @@ -833,12 +835,16 @@ export default {
).then(response => {
return response.json();
});
for (const key in content.body.fields) {
formData.append(key, content.body.fields[key]);
}
formData.append('file', file);
fetch(content.body.signedUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/zip'
'Content-Length': file.size
},
method: 'PUT',
body: file
body: formData
}).then(response => {
if (!response.ok) {
this.ipfsProcessing = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
<p>
Check your website for {{ `${domainName}` }} here:
<a
:href="`https://${domainName}.link`"
:href="`http://${domainName}.link`"
target="_blank"
rel="noopener noreferrer"
>
Expand Down Expand Up @@ -475,10 +475,6 @@ export default {
},
methods: {
fileChange(e) {
// this.processingIpfs = true;
// const formData = new FormData();
// const reader = new FileReader();
// const _self = this;
if (e.target.files[0].type !== 'application/zip') {
this.$refs.zipInput.value = '';
Toast.responseHandler('Please Upload a zip file!', Toast.WARN);
Expand All @@ -502,20 +498,7 @@ export default {
return;
}
// formData.append('file', e.target.files[0]);
// this.uploadFile(formData);
this.uploadFile(e.target.files[0]);
// reader.onloadend = function (evt) {
// try {
// const binary = evt.target.result;
// const base64 = btoa(binary);
// _self.uploadFile(base64);
// } catch (e) {
// this.processingIpfs = false;
// Toast.responseHandler('Something went wrong', Toast.responseHandler);
// }
// };
// reader.readAsBinaryString(e.target.files[0]);
},
ipfsClick() {
const input = this.$refs.zipInput;
Expand Down
1 change: 0 additions & 1 deletion vueConfig/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,5 @@ module.exports = [
'https://dispatch.pokt.network:443',
'https://service.gcp.pokt.network:443',
'https://6szankrze5.execute-api.us-east-1.amazonaws.com:443',
'https://mew-ipfs-bucket.s3.us-west-2.amazonaws.com:443',
'https://s3.us-west-2.amazonaws.com:443'
];

0 comments on commit 32314d9

Please sign in to comment.