PostData modified for temporary lock
This commit is contained in:
parent
4be23cdc86
commit
a3828a602c
16
network.js
16
network.js
|
|
@ -5,7 +5,8 @@ import { Notify } from "quasar";
|
||||||
const API_URL = "/api";
|
const API_URL = "/api";
|
||||||
const SHA256_HMAC_KEY = "mykey";
|
const SHA256_HMAC_KEY = "mykey";
|
||||||
|
|
||||||
function PostData(varlist, messtype, applytype, onfinished) {
|
function PostDataControlled(varlist, messtype, applytype, onfinished, enable) {
|
||||||
|
if (!enable) return;
|
||||||
var pld = {};
|
var pld = {};
|
||||||
var data = {};
|
var data = {};
|
||||||
data.msgid = Math.floor(Date.now() / 1000);
|
data.msgid = Math.floor(Date.now() / 1000);
|
||||||
|
|
@ -18,14 +19,15 @@ function PostData(varlist, messtype, applytype, onfinished) {
|
||||||
pld.data = data;
|
pld.data = data;
|
||||||
pld.signature = sha256.hmac(SHA256_HMAC_KEY, JSON.stringify(data));
|
pld.signature = sha256.hmac(SHA256_HMAC_KEY, JSON.stringify(data));
|
||||||
|
|
||||||
|
|
||||||
api
|
api
|
||||||
.post(API_URL, JSON.stringify(pld), {
|
.post(API_URL, JSON.stringify(pld), {
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
var resp = response.data.data.payload.variables;
|
if (enable) {
|
||||||
for (var k in resp) varlist[k] = resp[k];
|
var resp = response.data.data.payload.variables;
|
||||||
|
for (var k in resp) varlist[k] = resp[k];
|
||||||
|
}
|
||||||
if (onfinished) onfinished();
|
if (onfinished) onfinished();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -34,7 +36,11 @@ function PostData(varlist, messtype, applytype, onfinished) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { PostData };
|
|
||||||
|
function PostData(varlist, messtype, applytype, onfinished) {
|
||||||
|
PostDataControlled(varlist, messtype, applytype, onfinished, true);
|
||||||
|
}
|
||||||
|
export { PostData, PostDataControlled };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user