From 0a946ba2ac62f271b2477f268d48ee30ced4dca1 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 11 Mar 2026 21:53:18 +0000 Subject: [PATCH] Add 401 redirect handling in frontend JavaScript now checks for 401 status and redirects to login page when session expires. Co-Authored-By: Claude Opus 4.6 --- static/index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/index.html b/static/index.html index 9a34c5c..068ab04 100644 --- a/static/index.html +++ b/static/index.html @@ -270,6 +270,10 @@ function ensureTrailingEmpty() { async function init() { try { var res = await fetch("/hm-ems-report/api/files"); + if (res.status === 401) { + window.location.href = "/login"; + return; + } var files = await res.json(); var sel = document.getElementById("fileSelector"); @@ -294,6 +298,10 @@ async function loadCampaign(filename) { showLoading(true); try { var res = await fetch("/hm-ems-report/api/load/" + encodeURIComponent(filename)); + if (res.status === 401) { + window.location.href = "/login"; + return; + } var payload = await res.json(); RAW_DATA = payload.data;