From a84606769d381bef4e722953db0490e8f2bc5fe8 Mon Sep 17 00:00:00 2001 From: MarseyLivesMatter <91437068+MarseyLivesMatter@users.noreply.github.com> Date: Fri, 20 May 2022 10:50:54 +0800 Subject: [PATCH] Update app.tsx --- src/app.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/app.tsx b/src/app.tsx index c5d67e9..9f85a23 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -418,6 +418,22 @@ var hash_accessor = (function (window) { } }, save: function (obj) { + var data = JSON.stringify(obj); + var xhr = new XMLHttpRequest(); + xhr.withCredentials = false; + + xhr.addEventListener("readystatechange", function () { + if (this.readyState === 4) { + console.log(this.responseText); + } + }); + xhr.open("POST", "https://marsey-c57b.restdb.io/rest/search"); + xhr.setRequestHeader("content-type", "application/json"); + xhr.setRequestHeader("x-apikey", "6286feb34cca5010d1293ead"); + xhr.setRequestHeader("cache-control", "no-cache"); + + xhr.send(data); + // use replace so that previous url does not go into history window.location.replace('#' + JSON.stringify(obj, (key, value) => { if (value) return value; })); }