|
41 | 41 | }, |
42 | 42 | methods: { |
43 | 43 | handleOpenIde: function() { |
| 44 | + let createHiddenField = function(name, value) { |
| 45 | + let input = document.createElement('input'); |
| 46 | + input.setAttribute('type', 'hidden'); |
| 47 | + input.setAttribute('name', name); |
| 48 | + input.setAttribute('value', value); |
| 49 | + return input; |
| 50 | + } |
| 51 | +
|
44 | 52 | let form = document.createElement('form'); |
45 | 53 | form.setAttribute('method', 'post'); |
46 | 54 | form.setAttribute('action', this.data.ideUrl); |
47 | 55 | 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)); |
| 56 | + form.appendChild(createHiddenField('query', JSON.stringify(this.context.query.query))); |
| 57 | + form.appendChild(createHiddenField('variables', JSON.stringify(this.context.query.variables))); |
52 | 58 | document.body.appendChild(form); |
53 | 59 | form.submit(); |
54 | 60 | 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 | | - // }) |
78 | 61 | } |
79 | 62 | } |
80 | 63 | } |
|
0 commit comments