|
41 | 41 | }, |
42 | 42 | methods: { |
43 | 43 | 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 | + // }) |
65 | 78 | } |
66 | 79 | } |
67 | 80 | } |
|
0 commit comments