feat: bump client-services (accumulated feature work + deploy fixes)
Snapshot of in-progress work across local_backend, manager_dashboard, and waiter_pwa (pricing, chat, fiscal, prep zones, recovery codes, CRM, inventory, permissions), plus the nginx/docker-compose deploy fixes for the Unraid + NPM reverse-proxy setup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
29
waiter_pwa/src/hooks/useFailedPrintCount.js
Normal file
29
waiter_pwa/src/hooks/useFailedPrintCount.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import client from '../api/client'
|
||||
|
||||
// Polls /api/orders/pending-prints every 8s and returns the count of pending print jobs.
|
||||
export default function useFailedPrintCount() {
|
||||
const [count, setCount] = useState(0)
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
|
||||
async function refresh() {
|
||||
try {
|
||||
const res = await client.get('/api/orders/pending-prints')
|
||||
if (!cancelled) setCount(res.data?.count ?? 0)
|
||||
} catch {
|
||||
// Network error — leave count as-is
|
||||
}
|
||||
}
|
||||
|
||||
refresh()
|
||||
const id = setInterval(refresh, 8000)
|
||||
return () => {
|
||||
cancelled = true
|
||||
clearInterval(id)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return count
|
||||
}
|
||||
Reference in New Issue
Block a user