fix(ui): keep incident polling tolerant of approval context
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 16s
CD Pipeline / build-and-deploy (push) Successful in 5m36s
CD Pipeline / post-deploy-checks (push) Successful in 1m0s

This commit is contained in:
Your Name
2026-06-29 14:45:36 +08:00
parent 15824e9eca
commit 7ff959b6a8
2 changed files with 11 additions and 7 deletions

View File

@@ -63,16 +63,20 @@ export function useIncidents(options: UseIncidentsOptions = {}): UseIncidentsRes
const fetchData = useCallback(async () => {
try {
// 並行請求 incidents 和 pending approvals
const [incidentsRes, approvalsRes] = await Promise.all([
apiClient.listIncidents(),
apiClient.getPendingApprovals(),
])
const incidentsRes = await apiClient.listIncidents()
let approvals: ApprovalResponse[] = []
try {
const approvalsRes = await apiClient.getPendingApprovals()
approvals = approvalsRes.approvals
} catch {
approvals = []
}
if (!mountedRef.current) return
setIncidents(incidentsRes.incidents)
setPendingApprovals(approvalsRes.approvals)
setPendingApprovals(approvals)
setError(null)
setLastUpdated(new Date())
} catch (err) {

View File

@@ -1027,7 +1027,7 @@ export const apiClient = {
// =========================================================================
async getPendingApprovals() {
const res = await fetch(`${API_BASE_URL}/approvals/pending`)
const res = await fetch(`${API_BASE_URL}/approvals/pending?project_id=awoooi`)
return handleResponse<PendingApprovalsResponse>(res)
},