Skip to content

Commit e0e4eb2

Browse files
committed
fetch --> form
1 parent 30d75c9 commit e0e4eb2

4 files changed

Lines changed: 36 additions & 23 deletions

File tree

dist/widgets.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "widgets",
3-
"version": "1.3.18",
3+
"version": "1.3.19",
44
"description": "Blockchain Visualization Widgets",
55
"main": "dist/widgets.js",
66
"directories": {

src/components/base.vue

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,40 @@
4141
},
4242
methods: {
4343
handleOpenIde: function() {
44-
let wwindow = window.open()
45-
fetch(this.data.ideUrl, {
46-
method: 'POST',
47-
headers: {
48-
'Content-Type': 'application/json',
49-
Accept: 'application/json',
50-
},
51-
body: JSON.stringify({
52-
query: this.context.query.query,
53-
variables: JSON.stringify(this.context.query.variables),
54-
}),
55-
})
56-
.then((res) => {
57-
if (res.status === 200 || res.status === 302) {
58-
wwindow.location.href = res.url
59-
// window.open(res.url, '_blank').focus()
60-
// res.redirect(302, res.url)
61-
} else {
62-
console.log(res.message)
63-
}
64-
})
44+
let form = document.createElement('form');
45+
form.setAttribute('method', 'post');
46+
form.setAttribute('action', this.data.ideUrl);
47+
form.setAttribute('target', '_blank');
48+
49+
let formData = new FormData();
50+
formData.append('query', this.data.query);
51+
formData.append('variables', JSON.stringify(this.data.variables));
52+
document.body.appendChild(form);
53+
form.submit();
54+
document.body.removeChild(form);
55+
56+
57+
// let wwindow = window.open()
58+
// fetch(this.data.ideUrl, {
59+
// method: 'POST',
60+
// headers: {
61+
// 'Content-Type': 'application/json',
62+
// Accept: 'application/json',
63+
// },
64+
// body: JSON.stringify({
65+
// query: this.context.query.query,
66+
// variables: JSON.stringify(this.context.query.variables),
67+
// }),
68+
// })
69+
// .then((res) => {
70+
// if (res.status === 200 || res.status === 302) {
71+
// wwindow.location.href = res.url
72+
// // window.open(res.url, '_blank').focus()
73+
// // res.redirect(302, res.url)
74+
// } else {
75+
// console.log(res.message)
76+
// }
77+
// })
6578
}
6679
}
6780
}

src/index.html

Whitespace-only changes.

0 commit comments

Comments
 (0)