Retiré des console.log() unsafes

This commit is contained in:
Victor Turgeon 2022-11-22 12:13:19 -05:00
parent b6eb64ef75
commit 6120bf544a
5 changed files with 0 additions and 22 deletions

View File

@ -32,14 +32,12 @@ const Inventaire = () => {
const handleAddItem = async (morceau) => {
console.log(morceau);
let formData = new FormData();
Object.keys(morceau).map((k) => {
formData.set(k, morceau[k]);
});
console.log(formData);
const response = await fetch(`https://localhost:7292/api/Product`, {
method: 'POST',
@ -52,7 +50,6 @@ const Inventaire = () => {
})
const newMorceau = await response.json();
console.log(newMorceau);
if (response.ok) {
setMorceaux([...morceaux, { ...newMorceau }]);
@ -80,7 +77,6 @@ const Inventaire = () => {
mode: 'cors',
credentials: 'include'
}).then(async (response) => {
console.log(response);
if (response.ok) {
const deletedId = await response.json();
setMorceaux(morceaux.filter((morceau) => morceau.id !== deletedId));
@ -88,7 +84,6 @@ const Inventaire = () => {
onShowAlert('Suppression de:', `${name} avec succès!`, 2000);
}
else {
console.log("test");
mySwal.fire({
title: `Erreur lors de la suppression de ${name}`,
text: `L'erreur: ${response}`,
@ -103,8 +98,6 @@ const Inventaire = () => {
const handleModifyItem = async (morceau, oldTitle) => {
console.log(morceau);
mySwal.fire({
title: `Modifier ${oldTitle}?`,

View File

@ -22,7 +22,6 @@ const Invoices = () => {
}).then(async (response) => {
if (response.ok) {
var json = await response.json();
console.log(json);
setInvoices(json);
}
else{
@ -47,7 +46,6 @@ const Invoices = () => {
mode: 'cors',
credentials: 'include'
}).then(async (response) => {
console.log(response);
if (response.ok) {
const deletedId = await response.json();
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
@ -55,7 +53,6 @@ const Invoices = () => {
onShowAlert('Suppression de la commande avec succès!', 2000);
}
else {
console.log("test");
mySwal.fire({
title: `Erreur lors de la suppression de la commande...`,
text: `L'erreur: ${response}`,

View File

@ -70,7 +70,6 @@ const MyAddresses = () => {
mode: 'cors',
credentials: 'include'
}).then(async (response) => {
console.log(response);
if (response.ok) {
const deletedId = await response.json();
setUserAddresses(userAddresses.filter((address) => address.id !== deletedId));
@ -78,7 +77,6 @@ const MyAddresses = () => {
onShowAlert('Suppression de:', `${address.civicNumber} ${address.street} avec succès!`, 2000);
}
else {
console.log("test");
mySwal.fire({
title: `Erreur lors de la suppression de ${address.civicNumber} ${address.street}`,
text: `L'erreur: ${response}`,
@ -91,14 +89,12 @@ const MyAddresses = () => {
}
const onSubmit = async (address) => {
console.log(address);
let formData = new FormData();
Object.keys(address).map((k) => {
formData.set(k, address[k]);
});
console.log(formData);
const response = await fetch(`https://localhost:7292/api/Address`, {
method: 'POST',
@ -111,7 +107,6 @@ const MyAddresses = () => {
})
const newAddress = await response.json();
console.log(newAddress);
if (response.ok) {
setUserAddresses([...userAddresses, { ...newAddress }]);

View File

@ -22,7 +22,6 @@ const MyInvoices = () => {
}).then(async (response) => {
if (response.ok) {
var json = await response.json();
console.log(json);
setInvoices(json);
}
else{
@ -47,7 +46,6 @@ const MyInvoices = () => {
mode: 'cors',
credentials: 'include'
}).then(async (response) => {
console.log(response);
if (response.ok) {
const deletedId = await response.json();
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
@ -55,7 +53,6 @@ const MyInvoices = () => {
onShowAlert('Suppression de la commande avec succès!', 2000);
}
else {
console.log("test");
mySwal.fire({
title: `Erreur lors de la suppression de la commande...`,
text: `L'erreur: ${response}`,

View File

@ -112,14 +112,12 @@ const ReviewInvoice = () => {
}
const handleConfirmer = async () => {
console.log(thisInvoice);
// let formData = new FormData();
// Object.keys(thisInvoice).map((k) => {
// formData.set(k, thisInvoice[k]);
// });
// console.log(formData);
const json = JSON.stringify(thisInvoice);
const response = await fetch(`https://localhost:7292/api/Invoice`, {
@ -132,8 +130,6 @@ const ReviewInvoice = () => {
},
body: json
})
console.log(json);
console.log(await response.json());
if (response.ok) {
mySwal.fire({
title: 'Commande envoyée avec succès!',