feat(web): clientes e catálogo funcionando com dados do ERP

- clients.ts, catalog.ts: corrige bug res.ok/res.json() — apiFetch retorna JSON direto
- catalog.service.ts: corrige nomes de coluna da vw_produtos (descr_det, lista_pauta,
  remove preco_com_ipi inexistente)
- CatalogPage.tsx: nova tela — código, descrição, grupo, marca, preço, estoque
- router.tsx: adiciona rota /catalogo

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 14:46:25 +00:00
parent 24408ecd83
commit 1f8a9d872a
5 changed files with 148 additions and 20 deletions

View File

@@ -27,8 +27,7 @@ export function useClientList(params: Partial<ClientListQuery> = {}) {
queryKey: CLIENT_KEYS.list(params),
queryFn: async () => {
const res = await apiFetch(`/clients${query ? `?${query}` : ''}`);
if (!res.ok) throw new Error(`clients list error ${res.status}`);
return ClientListResponseSchema.parse(await res.json());
return ClientListResponseSchema.parse(res);
},
});
}
@@ -38,8 +37,7 @@ export function useClientDetail(id: number | string | undefined) {
queryKey: CLIENT_KEYS.detail(Number(id)),
queryFn: async () => {
const res = await apiFetch(`/clients/${id}`);
if (!res.ok) throw new Error(`client detail error ${res.status}`);
return ClientDetailSchema.parse(await res.json());
return ClientDetailSchema.parse(res);
},
enabled: !!id,
});