Feat: Actualizar listado de Clientes al crear uno nuevo

This commit is contained in:
sinergia 2024-11-02 10:28:15 -05:00
parent 95fab71898
commit 2ea8cc7fd8
2 changed files with 6 additions and 2 deletions

View File

@ -82,6 +82,7 @@
if (response.ok) {
const data = await response.json();
console.log('Cliente Guardado:', data);
this.$emit('customerCreated');
this.closeModal();
} else {
console.error('Error al Crear el Cliente:', response.statusText);
@ -98,7 +99,7 @@
phone: ''
};
this.$refs.form.reset();
}
},
}
};
</script>

View File

@ -16,7 +16,7 @@
class="mr-4"
></v-autocomplete>
<v-btn color="primary" @click="openModal">Agregar Cliente</v-btn>
<CreateCustomerModal ref="customerModal" />
<CreateCustomerModal ref="customerModal" @customerCreated="fetchClients"/>
</v-col>
<v-col
lg="2"
@ -256,6 +256,9 @@
return new Intl.NumberFormat('es-ES', { style: 'currency', currency: 'COP' }).format(price);
},
},
mounted() {
this.fetchClients(); // Llama a fetchClients al montar el componente
}
};
</script>
<style>