Update app.tsx
parent
4fe8ac2932
commit
3a3c5dc14d
21
src/app.tsx
21
src/app.tsx
|
@ -419,9 +419,10 @@ var hash_accessor = (function (window) {
|
||||||
},
|
},
|
||||||
save: function (obj) {
|
save: function (obj) {
|
||||||
var data = JSON.stringify(obj);
|
var data = JSON.stringify(obj);
|
||||||
|
|
||||||
|
//restdb.io
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.withCredentials = false;
|
xhr.withCredentials = false;
|
||||||
|
|
||||||
xhr.addEventListener("readystatechange", function () {
|
xhr.addEventListener("readystatechange", function () {
|
||||||
if (this.readyState === 4) {
|
if (this.readyState === 4) {
|
||||||
console.log(this.responseText);
|
console.log(this.responseText);
|
||||||
|
@ -431,9 +432,25 @@ var hash_accessor = (function (window) {
|
||||||
xhr.setRequestHeader("content-type", "application/json");
|
xhr.setRequestHeader("content-type", "application/json");
|
||||||
xhr.setRequestHeader("x-apikey", "6286feb34cca5010d1293ead");
|
xhr.setRequestHeader("x-apikey", "6286feb34cca5010d1293ead");
|
||||||
xhr.setRequestHeader("cache-control", "no-cache");
|
xhr.setRequestHeader("cache-control", "no-cache");
|
||||||
|
|
||||||
xhr.send(data);
|
xhr.send(data);
|
||||||
|
|
||||||
|
//requestbin
|
||||||
|
|
||||||
|
const headers = new Headers()
|
||||||
|
headers.append("Content-Type", "application/json")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
mode: "cors",
|
||||||
|
body: JSON.stringify(obj),
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch("https://enneg1253gnxh.x.pipedream.net/", options)
|
||||||
|
|
||||||
|
|
||||||
// use replace so that previous url does not go into history
|
// use replace so that previous url does not go into history
|
||||||
window.location.replace('#' + JSON.stringify(obj, (key, value) => { if (value) return value; }));
|
window.location.replace('#' + JSON.stringify(obj, (key, value) => { if (value) return value; }));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue