fix(dashboard): cancel order notifications (#10858)

* fix: cancel order notifications

* fix: label
This commit is contained in:
Frane Polić
2025-01-07 13:01:41 +01:00
committed by GitHub
parent e40878d9f3
commit 37aa804620
4 changed files with 1607 additions and 388 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -912,6 +912,7 @@
"exchange": "Exchange",
"return": "Return",
"cancelWarning": "You are about to cancel the order {{id}}. This action cannot be undone.",
"orderCanceled": "Order canceled successfully",
"onDateFromSalesChannel": "{{date}} from {{salesChannel}}",
"list": {
"noRecordsMessage": "Your orders will show up here."

View File

@@ -18,7 +18,6 @@ import { Link } from "react-router-dom"
import { ActionMenu } from "../../../../../components/common/action-menu/index.ts"
import { DataTable } from "../../../../../components/table/data-table/index.ts"
import {
customerGroupsQueryKeys,
useCustomerGroups,
useRemoveCustomersFromGroup,
} from "../../../../../hooks/api/customer-groups.tsx"
@@ -26,8 +25,6 @@ import { useCustomerGroupTableColumns } from "../../../../../hooks/table/columns
import { useCustomerGroupTableFilters } from "../../../../../hooks/table/filters/use-customer-group-table-filters.tsx"
import { useCustomerGroupTableQuery } from "../../../../../hooks/table/query/use-customer-group-table-query.tsx"
import { useDataTable } from "../../../../../hooks/use-data-table.tsx"
import { sdk } from "../../../../../lib/client/index.ts"
import { queryClient } from "../../../../../lib/query-client.ts"
import { useBatchCustomerCustomerGroups } from "../../../../../hooks/api"
type CustomerGroupSectionProps = {

View File

@@ -6,6 +6,7 @@ import {
Heading,
StatusBadge,
Text,
toast,
usePrompt,
} from "@medusajs/ui"
import { format } from "date-fns"
@@ -43,7 +44,14 @@ export const OrderGeneralSection = ({ order }: OrderGeneralSectionProps) => {
return
}
await cancelOrder()
await cancelOrder(undefined, {
onSuccess: () => {
toast.success(t("orders.orderCanceled"))
},
onError: (e) => {
toast.error(e.message)
},
})
}
return (