perf(web): redirect to /auth on fail to get TDBMS response

This commit is contained in:
Masahiko AMANO 2023-01-29 16:00:02 +03:00
parent c78e380d23
commit bf4e127908

View File

@ -3,8 +3,8 @@ var sasahyou, sappyou, shoppyou;
function sasa_load(id) { function sasa_load(id) {
resp = tdb_query("$TFM", 16, id < 0 ? "" : `${id}`); resp = tdb_query("$TFM", 16, id < 0 ? "" : `${id}`);
if (resp == null) { if (resp == null) {
alert("Unauthorized, go to /auth and authorize"); $(location).attr("href", "/auth");
return; throw new Error("Unauthorized");
} }
if (!resp.status) { if (!resp.status) {
alert("Something went wrong"); alert("Something went wrong");
@ -21,8 +21,8 @@ function sasa_load(id) {
function tanzaku_load(id) { function tanzaku_load(id) {
resp = tdb_query("$TFM", 32, id < 0 ? "" : `${id}`); resp = tdb_query("$TFM", 32, id < 0 ? "" : `${id}`);
if (resp == null) { if (resp == null) {
alert("Unauthorized, go to /auth and authorize"); $(location).attr("href", "/auth");
return; throw new Error("Unauthorized");
} }
if (!resp.status) { if (!resp.status) {
alert("Something went wrong"); alert("Something went wrong");
@ -39,8 +39,8 @@ function tanzaku_load(id) {
function kazari_load() { function kazari_load() {
resp = tdb_query("$TFM", 8, ""); resp = tdb_query("$TFM", 8, "");
if (resp == null) { if (resp == null) {
alert("Unauthorized, go to /auth and authorize"); $(location).attr("href", "/auth");
return; throw new Error("Unauthorized");
} }
if (!resp.status) { if (!resp.status) {
alert("Something went wrong"); alert("Something went wrong");