Show Offline when the server is unreachable, and document the pilot changes
The terminal's badge only looked at navigator.onLine, so it said Online while the server was down. It now also reflects whether the last sync or health check reached the server. The cart badge no longer covers the product name. docs/PILOT_READINESS.md records what changed against the PRD review, the decisions taken (offline sales may take stock negative, transfers may not, server price wins but differences are flagged), rollout notes, and what is still open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -217,6 +217,11 @@ async function doFlush(owner: QueueOwner): Promise<FlushResult> {
|
||||
let synced = 0;
|
||||
let rejected = 0;
|
||||
let offline = false;
|
||||
if (pending.length === 0) {
|
||||
// Nothing to send: still find out whether the server is reachable, so
|
||||
// the terminal's Online/Offline badge is truthful.
|
||||
offline = !(await fetch("/api/health", { cache: "no-store" }).then((r) => r.ok).catch(() => false));
|
||||
}
|
||||
for (let i = 0; i < pending.length; i += MAX_SALES_PER_REQUEST) {
|
||||
const chunk = pending.slice(i, i + MAX_SALES_PER_REQUEST);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user