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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user