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;