@teamnovu/kit-shopware-composables 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -518,6 +518,8 @@ function wt(e) {
|
|
|
518
518
|
onSuccess: async (n, r, a) => {
|
|
519
519
|
var u, o;
|
|
520
520
|
await Promise.all([
|
|
521
|
+
// Clear cart after successful order creation
|
|
522
|
+
t.invalidateQueries({ queryKey: x.get() }),
|
|
521
523
|
// Invalidate order list to refetch data
|
|
522
524
|
t.invalidateQueries({ queryKey: U.lists() })
|
|
523
525
|
]), await ((o = i((u = i(e)) == null ? void 0 : u.onSuccess)) == null ? void 0 : o(n, r, a));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/
|
|
|
2
2
|
import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
|
|
3
3
|
import { unref } from 'vue'
|
|
4
4
|
import { useShopwareQueryClient } from '../../inject'
|
|
5
|
-
import { orderKeys } from '../../keys'
|
|
5
|
+
import { cartKeys, orderKeys } from '../../keys'
|
|
6
6
|
import { unrefOptions } from '../../util/unrefOptions'
|
|
7
7
|
import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
|
|
8
8
|
|
|
@@ -25,6 +25,9 @@ export function useCreateOrderMutation(
|
|
|
25
25
|
},
|
|
26
26
|
onSuccess: async (data, variables, context) => {
|
|
27
27
|
await Promise.all([
|
|
28
|
+
// Clear cart after successful order creation
|
|
29
|
+
queryClient.invalidateQueries({ queryKey: cartKeys.get() }),
|
|
30
|
+
|
|
28
31
|
// Invalidate order list to refetch data
|
|
29
32
|
queryClient.invalidateQueries({ queryKey: orderKeys.lists() }),
|
|
30
33
|
])
|