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:
parent
47e003213d
commit
7cb41a4f9c
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user