Parcourir la source

no message

production
[email protected] il y a 5 heures
Parent
révision
98348433ff
2 fichiers modifiés avec 16 ajouts et 2 suppressions
  1. +8
    -1
      src/components/ClientMonitor/LabelPrinterMonitorPanel.tsx
  2. +8
    -1
      src/components/ClientMonitor/PrinterMonitorTab.tsx

+ 8
- 1
src/components/ClientMonitor/LabelPrinterMonitorPanel.tsx Voir le fichier

@@ -189,6 +189,11 @@ export default function LabelPrinterMonitorPanel({
{ method: "POST" },
);
if (checkRes.status === 401 || checkRes.status === 403) return;
if (checkRes.status === 404) {
throw new Error(
"標籤印表機監控 API 未啟用,請重新啟動後端並確認已部署最新版本"
);
}
if (!checkRes.ok) {
throw new Error(`check HTTP ${checkRes.status}`);
}
@@ -197,7 +202,9 @@ export default function LabelPrinterMonitorPanel({
setSummary(checkData.summary ?? null);
} catch (e) {
console.error("label printer monitor check", e);
setError("無法檢查標籤印表機狀態");
setError(
e instanceof Error ? e.message : "無法檢查標籤印表機狀態"
);
} finally {
setLoading(false);
checkInFlightRef.current = false;


+ 8
- 1
src/components/ClientMonitor/PrinterMonitorTab.tsx Voir le fichier

@@ -85,6 +85,11 @@ export default function PrinterMonitorTab({ active, refreshAt = 0 }: Props) {
{ method: "POST" }
);
if (response.status === 401 || response.status === 403) return;
if (response.status === 404) {
throw new Error(
"印表機監控 API 未啟用,請重新啟動後端並確認已部署最新版本"
);
}
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
@@ -94,7 +99,9 @@ export default function PrinterMonitorTab({ active, refreshAt = 0 }: Props) {
setSummary(data.summary ?? null);
} catch (e) {
console.error("printer monitor check", e);
setError("無法檢查印表機連線");
setError(
e instanceof Error ? e.message : "無法檢查印表機連線"
);
} finally {
setLoading(false);
inFlightRef.current = false;


Chargement…
Annuler
Enregistrer