From bf4e127908dbbe6f71dc0682ea02b17d3904348c Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Sun, 29 Jan 2023 16:00:02 +0300 Subject: [PATCH] perf(web): redirect to /auth on fail to get TDBMS response --- web/public/js/tfm.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/public/js/tfm.js b/web/public/js/tfm.js index f9e23a4..2377f28 100644 --- a/web/public/js/tfm.js +++ b/web/public/js/tfm.js @@ -3,8 +3,8 @@ var sasahyou, sappyou, shoppyou; function sasa_load(id) { resp = tdb_query("$TFM", 16, id < 0 ? "" : `${id}`); if (resp == null) { - alert("Unauthorized, go to /auth and authorize"); - return; + $(location).attr("href", "/auth"); + throw new Error("Unauthorized"); } if (!resp.status) { alert("Something went wrong"); @@ -21,8 +21,8 @@ function sasa_load(id) { function tanzaku_load(id) { resp = tdb_query("$TFM", 32, id < 0 ? "" : `${id}`); if (resp == null) { - alert("Unauthorized, go to /auth and authorize"); - return; + $(location).attr("href", "/auth"); + throw new Error("Unauthorized"); } if (!resp.status) { alert("Something went wrong"); @@ -39,8 +39,8 @@ function tanzaku_load(id) { function kazari_load() { resp = tdb_query("$TFM", 8, ""); if (resp == null) { - alert("Unauthorized, go to /auth and authorize"); - return; + $(location).attr("href", "/auth"); + throw new Error("Unauthorized"); } if (!resp.status) { alert("Something went wrong");