|
|
|
@@ -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; |
|
|
|
|