Skip to content

Commit

Permalink
fix(composables): add checkPromotions flag to the loadOrders para…
Browse files Browse the repository at this point in the history
…ms of `useCustomerOrders` composable (#1492)
  • Loading branch information
mkucmus authored Nov 28, 2024
1 parent 2858e3c commit a03a492
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-dogs-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

`useCustomerOrders` - added checkPromotions flag for loading orders
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref, computed } from "vue";
import type { Ref, ComputedRef } from "vue";
import { useShopwareContext } from "#imports";
import type { Schemas } from "#shopware";
import type { Schemas, operations } from "#shopware";

export type UseCustomerOrdersReturn = {
/**
Expand All @@ -17,7 +17,9 @@ export type UseCustomerOrdersReturn = {
/**
* Fetches the orders list and assigns the result to the `orders` property
*/
loadOrders(parameters?: Schemas["Criteria"]): Promise<void>;
loadOrders(
parameters?: operations["readOrder post /order"]["body"],
): Promise<void>;
/**
* Current page number
*/
Expand Down Expand Up @@ -50,7 +52,7 @@ export function useCustomerOrders(): UseCustomerOrdersReturn {
const currentParams = ref<Schemas["Criteria"]>({});

const loadOrders = async (
parameters: Schemas["Criteria"] = {},
parameters: operations["readOrder post /order"]["body"] = {},
): Promise<void> => {
const params = {
...parameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe("useDefaultOrderAssociations", () => {
},
},
},
"checkPromotion": true,
}
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function useDefaultOrderAssociations(): UseDefaultOrderAssociationsReturn
},
},
},
checkPromotion: true,
};

return orderAssociations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export function useOrderDetails(
},
],
associations: mergedAssociations.associations,
checkPromotion: true,
} as Schemas["Criteria"];

const orderDetailsResponse = await apiClient.invoke(
Expand Down
1 change: 1 addition & 0 deletions templates/vue-demo-store/pages/account/order.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ await useAsyncData("getOrders", () => {
return loadOrders({
limit: limit.value,
page: route.query.p ? Number(route.query.p) : defaultPage,
checkPromotion: true, // determines whether "paymentChangeable" list is available in the response
associations: {
stateMachineState: {},
},
Expand Down

0 comments on commit a03a492

Please sign in to comment.