Retiré des console.log() unsafes
This commit is contained in:
parent
b6eb64ef75
commit
6120bf544a
@ -32,14 +32,12 @@ const Inventaire = () => {
|
|||||||
|
|
||||||
const handleAddItem = async (morceau) => {
|
const handleAddItem = async (morceau) => {
|
||||||
|
|
||||||
console.log(morceau);
|
|
||||||
|
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
Object.keys(morceau).map((k) => {
|
Object.keys(morceau).map((k) => {
|
||||||
formData.set(k, morceau[k]);
|
formData.set(k, morceau[k]);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(formData);
|
|
||||||
|
|
||||||
const response = await fetch(`https://localhost:7292/api/Product`, {
|
const response = await fetch(`https://localhost:7292/api/Product`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -52,7 +50,6 @@ const Inventaire = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const newMorceau = await response.json();
|
const newMorceau = await response.json();
|
||||||
console.log(newMorceau);
|
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setMorceaux([...morceaux, { ...newMorceau }]);
|
setMorceaux([...morceaux, { ...newMorceau }]);
|
||||||
@ -80,7 +77,6 @@ const Inventaire = () => {
|
|||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
console.log(response);
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const deletedId = await response.json();
|
const deletedId = await response.json();
|
||||||
setMorceaux(morceaux.filter((morceau) => morceau.id !== deletedId));
|
setMorceaux(morceaux.filter((morceau) => morceau.id !== deletedId));
|
||||||
@ -88,7 +84,6 @@ const Inventaire = () => {
|
|||||||
onShowAlert('Suppression de:', `${name} avec succès!`, 2000);
|
onShowAlert('Suppression de:', `${name} avec succès!`, 2000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("test");
|
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Erreur lors de la suppression de ${name}`,
|
title: `Erreur lors de la suppression de ${name}`,
|
||||||
text: `L'erreur: ${response}`,
|
text: `L'erreur: ${response}`,
|
||||||
@ -103,8 +98,6 @@ const Inventaire = () => {
|
|||||||
|
|
||||||
|
|
||||||
const handleModifyItem = async (morceau, oldTitle) => {
|
const handleModifyItem = async (morceau, oldTitle) => {
|
||||||
console.log(morceau);
|
|
||||||
|
|
||||||
|
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Modifier ${oldTitle}?`,
|
title: `Modifier ${oldTitle}?`,
|
||||||
|
@ -22,7 +22,6 @@ const Invoices = () => {
|
|||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
var json = await response.json();
|
var json = await response.json();
|
||||||
console.log(json);
|
|
||||||
setInvoices(json);
|
setInvoices(json);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -47,7 +46,6 @@ const Invoices = () => {
|
|||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
console.log(response);
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const deletedId = await response.json();
|
const deletedId = await response.json();
|
||||||
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
||||||
@ -55,7 +53,6 @@ const Invoices = () => {
|
|||||||
onShowAlert('Suppression de la commande avec succès!', 2000);
|
onShowAlert('Suppression de la commande avec succès!', 2000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("test");
|
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Erreur lors de la suppression de la commande...`,
|
title: `Erreur lors de la suppression de la commande...`,
|
||||||
text: `L'erreur: ${response}`,
|
text: `L'erreur: ${response}`,
|
||||||
|
@ -70,7 +70,6 @@ const MyAddresses = () => {
|
|||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
console.log(response);
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const deletedId = await response.json();
|
const deletedId = await response.json();
|
||||||
setUserAddresses(userAddresses.filter((address) => address.id !== deletedId));
|
setUserAddresses(userAddresses.filter((address) => address.id !== deletedId));
|
||||||
@ -78,7 +77,6 @@ const MyAddresses = () => {
|
|||||||
onShowAlert('Suppression de:', `${address.civicNumber} ${address.street} avec succès!`, 2000);
|
onShowAlert('Suppression de:', `${address.civicNumber} ${address.street} avec succès!`, 2000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("test");
|
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Erreur lors de la suppression de ${address.civicNumber} ${address.street}`,
|
title: `Erreur lors de la suppression de ${address.civicNumber} ${address.street}`,
|
||||||
text: `L'erreur: ${response}`,
|
text: `L'erreur: ${response}`,
|
||||||
@ -91,14 +89,12 @@ const MyAddresses = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit = async (address) => {
|
const onSubmit = async (address) => {
|
||||||
console.log(address);
|
|
||||||
|
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
Object.keys(address).map((k) => {
|
Object.keys(address).map((k) => {
|
||||||
formData.set(k, address[k]);
|
formData.set(k, address[k]);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(formData);
|
|
||||||
|
|
||||||
const response = await fetch(`https://localhost:7292/api/Address`, {
|
const response = await fetch(`https://localhost:7292/api/Address`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -111,7 +107,6 @@ const MyAddresses = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const newAddress = await response.json();
|
const newAddress = await response.json();
|
||||||
console.log(newAddress);
|
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setUserAddresses([...userAddresses, { ...newAddress }]);
|
setUserAddresses([...userAddresses, { ...newAddress }]);
|
||||||
|
@ -22,7 +22,6 @@ const MyInvoices = () => {
|
|||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
var json = await response.json();
|
var json = await response.json();
|
||||||
console.log(json);
|
|
||||||
setInvoices(json);
|
setInvoices(json);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -47,7 +46,6 @@ const MyInvoices = () => {
|
|||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
console.log(response);
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const deletedId = await response.json();
|
const deletedId = await response.json();
|
||||||
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
||||||
@ -55,7 +53,6 @@ const MyInvoices = () => {
|
|||||||
onShowAlert('Suppression de la commande avec succès!', 2000);
|
onShowAlert('Suppression de la commande avec succès!', 2000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("test");
|
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Erreur lors de la suppression de la commande...`,
|
title: `Erreur lors de la suppression de la commande...`,
|
||||||
text: `L'erreur: ${response}`,
|
text: `L'erreur: ${response}`,
|
||||||
|
@ -112,14 +112,12 @@ const ReviewInvoice = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleConfirmer = async () => {
|
const handleConfirmer = async () => {
|
||||||
console.log(thisInvoice);
|
|
||||||
|
|
||||||
// let formData = new FormData();
|
// let formData = new FormData();
|
||||||
// Object.keys(thisInvoice).map((k) => {
|
// Object.keys(thisInvoice).map((k) => {
|
||||||
// formData.set(k, thisInvoice[k]);
|
// formData.set(k, thisInvoice[k]);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// console.log(formData);
|
|
||||||
const json = JSON.stringify(thisInvoice);
|
const json = JSON.stringify(thisInvoice);
|
||||||
|
|
||||||
const response = await fetch(`https://localhost:7292/api/Invoice`, {
|
const response = await fetch(`https://localhost:7292/api/Invoice`, {
|
||||||
@ -132,8 +130,6 @@ const ReviewInvoice = () => {
|
|||||||
},
|
},
|
||||||
body: json
|
body: json
|
||||||
})
|
})
|
||||||
console.log(json);
|
|
||||||
console.log(await response.json());
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: 'Commande envoyée avec succès!',
|
title: 'Commande envoyée avec succès!',
|
||||||
|
Loading…
Reference in New Issue
Block a user