fix: redirect expired sessions to login

This commit is contained in:
MengMengCode
2026-08-09 20:47:53 +08:00
parent 0e68dc6893
commit c19156e46a
7 changed files with 79 additions and 14 deletions
+2
View File
@@ -3,6 +3,7 @@ import { message } from "../ui";
import type { DeviceDetail, DeviceModem, ModemPnn } from "./types";
import { tl } from "../../lib/i18n";
import { lookupCarrier } from "../../lib/carrier";
import { notifyUnauthorized } from "../../api";
/* ---------------------------------------------------------------------------
* Lifecycle / status helpers (ported from the VoHive reference).
@@ -283,6 +284,7 @@ export async function readEventStream(
credentials: "include",
signal: handlers.signal,
});
if (response.status === 401) notifyUnauthorized();
if (!response.ok) throw new Error((await response.text()) || `HTTP ${response.status}`);
if (!response.body) throw new Error("No stream body");