Fix: Use existing table for credit cards

The SQL was updated to use the existing `cartoes_credito` table instead of creating a new one. This resolves the error and ensures compatibility with the existing database structure.
This commit is contained in:
gpt-engineer-app[bot] 2025-06-11 09:20:21 +00:00
parent 47e003213d
commit 7cb41a4f9c

View File

@ -44,7 +44,14 @@ export function useFaturas({ cartaoId }: UseFaturasProps) {
.order('mes', { ascending: false });
if (error) throw error;
setFaturas(data || []);
// Mapear os dados para garantir que status_pagamento seja do tipo correto
const faturasMapeadas = (data || []).map(fatura => ({
...fatura,
status_pagamento: fatura.status_pagamento as 'pendente' | 'pago' | 'vencido'
})) as FaturaCartao[];
setFaturas(faturasMapeadas);
} catch (error) {
console.error('Erro ao carregar faturas:', error);
} finally {