fix(web): fix tdb response checking in js
This commit is contained in:
@@ -4,11 +4,11 @@ $(document).on("click", "#btn-save", function (e) {
|
||||
return;
|
||||
}
|
||||
let resp = tdb_query(db_name, 4);
|
||||
if (resp.status) {
|
||||
alert("Successfully saved!");
|
||||
} else {
|
||||
if (resp == null || !resp.status) {
|
||||
alert("Something went wrong!");
|
||||
return;
|
||||
}
|
||||
alert("Successfully saved!");
|
||||
});
|
||||
|
||||
$(document).on("click", "#btn-reload", function (e) {
|
||||
@@ -20,14 +20,14 @@ $(document).on("click", "#btn-reload", function (e) {
|
||||
return;
|
||||
}
|
||||
let resp = tdb_query(db_name, 2);
|
||||
if (resp.status) {
|
||||
localStorage["sasahyou_mts"] = sasahyou_mts = 0;
|
||||
localStorage["sappyou_mts"] = sappyou_mts = 0;
|
||||
localStorage["shoppyou_mts"] = shoppyou_mts = 0;
|
||||
alert("Successfully reloaded database!");
|
||||
} else {
|
||||
if (resp == null || !resp.status) {
|
||||
alert("Something went wrong!");
|
||||
return;
|
||||
}
|
||||
localStorage["sasahyou_mts"] = sasahyou_mts = 0;
|
||||
localStorage["sappyou_mts"] = sappyou_mts = 0;
|
||||
localStorage["shoppyou_mts"] = shoppyou_mts = 0;
|
||||
alert("Successfully reloaded database!");
|
||||
});
|
||||
|
||||
$(document).on("click", "#btn-remove", function (e) {
|
||||
@@ -39,14 +39,14 @@ $(document).on("click", "#btn-remove", function (e) {
|
||||
return;
|
||||
}
|
||||
let resp = tdb_query(db_name, 1);
|
||||
if (resp.status) {
|
||||
localStorage.removeItem("db_name");
|
||||
db_name = null;
|
||||
localStorage["sasahyou_mts"] = sasahyou_mts = 0;
|
||||
localStorage["sappyou_mts"] = sappyou_mts = 0;
|
||||
localStorage["shoppyou_mts"] = shoppyou_mts = 0;
|
||||
alert("Successfully removed database!");
|
||||
} else {
|
||||
if (resp == null || !resp.status) {
|
||||
alert("Something went wrong!");
|
||||
return;
|
||||
}
|
||||
localStorage.removeItem("db_name");
|
||||
db_name = null;
|
||||
localStorage["sasahyou_mts"] = sasahyou_mts = 0;
|
||||
localStorage["sappyou_mts"] = sappyou_mts = 0;
|
||||
localStorage["shoppyou_mts"] = shoppyou_mts = 0;
|
||||
alert("Successfully removed database!");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user