Impl HTTPCRUD db
parent
c724f0ee0b
commit
3cd47b56cf
|
|
@ -1464,7 +1464,6 @@
|
||||||
do(method, key, data)
|
do(method, key, data)
|
||||||
{
|
{
|
||||||
var result = null;
|
var result = null;
|
||||||
console.log("DO:", this.toPath(key), method, data);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.toPath(key),
|
url: this.toPath(key),
|
||||||
type: method,
|
type: method,
|
||||||
|
|
@ -1474,17 +1473,15 @@
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
success: (data, statusText, jqXHR) => {
|
success: (data, statusText, jqXHR) => {
|
||||||
console.log(method, key, ": parsing: ", data);
|
if (! data)
|
||||||
if (data)
|
data = "null";
|
||||||
result = JSON.parse("" + data);
|
result = data;
|
||||||
console.log("parsed: ", result)
|
|
||||||
},
|
},
|
||||||
error: (jqXHR, statusText, err) => {
|
error: (jqXHR, statusText, err) => {
|
||||||
if (jqXHR.status > 410)
|
if (jqXHR.status > 410)
|
||||||
throw new Error("unexpected status: " + statusText + ": " + err);
|
throw new Error("unexpected status: " + statusText + ": " + err);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//console.log("DID:", this.toPath(key), method, data, result);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1505,7 +1502,8 @@
|
||||||
|
|
||||||
forEach(foo)
|
forEach(foo)
|
||||||
{
|
{
|
||||||
var result = this.do("GET", "", null);
|
var result = this.get("");
|
||||||
|
result = JSON.parse(result);
|
||||||
if (! result)
|
if (! result)
|
||||||
result = [];
|
result = [];
|
||||||
result.forEach((k) => {
|
result.forEach((k) => {
|
||||||
|
|
@ -1577,8 +1575,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
globalStorage = new MultiDatabase(
|
globalStorage = new MultiDatabase(
|
||||||
new NamespacedDatabase("A", new Local()),
|
new NamespacedDatabase("1", new HTTPCRUD()),
|
||||||
//new NamespacedDatabase("8", new HTTPCRUD()),
|
//new NamespacedDatabase("A", new Local()),
|
||||||
//new NamespacedDatabase("B", new Local()),
|
//new NamespacedDatabase("B", new Local()),
|
||||||
//new Bomber(),
|
//new Bomber(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue