umwd-components 0.1.694 → 0.1.695

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.694",
3
+ "version": "0.1.695",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -109,6 +109,9 @@ function CancelOpoDialog({
109
109
  }) {
110
110
  const [reason, setRoason] = useState<string>("");
111
111
  const [reasonError, setReasonError] = useState<string>("");
112
+
113
+ const { handleAddMessage } = useSnackbar();
114
+
112
115
  return (
113
116
  <form>
114
117
  <Dialog open={open}>
@@ -150,10 +153,21 @@ function CancelOpoDialog({
150
153
  setReasonError("Please provide a reason for the cancellation");
151
154
  return;
152
155
  }
153
- const res = await cancellationService("opos", orderID, reason);
154
- console.log("Cancellation response", res);
155
- revalidateCallback && revalidateCallback();
156
- handleClose();
156
+ setReasonError("");
157
+ try {
158
+ await cancellationService("opos", orderID, reason);
159
+ handleAddMessage({
160
+ message: "Order cancelled successfully",
161
+ severity: "success",
162
+ });
163
+ revalidateCallback && revalidateCallback();
164
+ handleClose();
165
+ } catch (error) {
166
+ handleAddMessage({
167
+ message: "Error cancelling order",
168
+ severity: "error",
169
+ });
170
+ }
157
171
  }}
158
172
  >
159
173
  Yes
@@ -3,7 +3,6 @@
3
3
  import { getAuthToken } from "../get-token";
4
4
  import { getStrapiURL } from "../../../lib/utils"; //"@/lib/utils";
5
5
 
6
- // TODO move to common services
7
6
  export async function cancellationService(
8
7
  path: string,
9
8
  id: number,
@@ -4,7 +4,6 @@ import { getAuthToken } from "../get-token";
4
4
  import { getStrapiURL } from "../../../lib/utils"; //"@/lib/utils";
5
5
  import { InvoiceOverwrites } from "../../../types/e-commerce/invoice/types";
6
6
 
7
- // TODO move to common services
8
7
  export async function confirmationService(
9
8
  path: string,
10
9
  ids: number[],