Skip to content

Commit

Permalink
frontend : fix various errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpochat committed Feb 27, 2024
1 parent a883f19 commit 486bc14
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions frontend/app/src/api/mock/MockApiCustomers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export class MockApiCustomers {
createCustomer(customer: Customer) {
return {...customer, id: 999}
}

}
2 changes: 1 addition & 1 deletion frontend/app/src/api/mock/MockApiSales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class MockApiSales {
}
}, {
id: 222,
unitPrice: 160,
unitPrice: 16,
quantity: 1,
packageLot: {
id: 2,
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/src/domains/customer/views/CustomersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default function CustomersList() {
function loadCustomers() {
apiBuilder.getAuthenticatedApi(keycloak).then(api => {
apiBuilder.invokeAuthenticatedApi(() => {
api.getCustomers((error, data, response) => {
api.getProducerCustomers((error, data, response) => {
if (error) {
console.error(error)
} else {
console.log('api.getSales called successfully. Returned data: ' + data)
console.log('api.getProducerCustomers called successfully. Returned data: ' + data)
setCustomers(data)
}
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/src/domains/sale/components/OrderSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function OrderSummary({ order: order }) {
}

function orderTotalPrice(order: Order): String {
return order.items.map(item => item.quantity * item.packageLot.quantity * item.packageLot.unitPrice)
return order.items?.map(item => item.quantity * item.packageLot.netWeight * item.unitPrice)
.reduce((totalPrice, itemPrice) => totalPrice + itemPrice)
}
}
2 changes: 1 addition & 1 deletion frontend/app/src/domains/sale/views/OrderForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function OrderForm({ sale: sale, returnCallback: returnCallback }
function loadCustomers() {
apiBuilder.getAuthenticatedApi(keycloak).then(api => {
apiBuilder.invokeAuthenticatedApi(() => {
api.getCustomers((error, data, response) => {
api.getProducerCustomers((error, data, response) => {
if (error) {
console.error(error)
} else {
Expand Down

0 comments on commit 486bc14

Please sign in to comment.