{
- Status === "Cancelled" &&
+ order?.Status === "Cancelled" &&
}
{
- Status === "Shipping" &&
+ order?.Status === "Shipping" &&
diff --git a/src/ShopNet/Admin/Order/Post.ts b/src/ShopNet/Admin/Order/Post.ts
index b4f4081..0743829 100644
--- a/src/ShopNet/Admin/Order/Post.ts
+++ b/src/ShopNet/Admin/Order/Post.ts
@@ -24,15 +24,12 @@ export abstract class AdminOrderPost extends AdminNet {
/**
* @author Aloento
* @since 0.5.0
- * @version 0.2.1
+ * @version 0.3.0
*/
- public static useClose(options: Options) {
- return useRequest(async (orderId, reason) => {
- const res = await this.Invoke("OrderPostClose", orderId, reason);
- this.EnsureTrue(res);
- return res;
- }, options);
+ public static useClose(options: Options) {
+ return useRequest((orderId, reason) => this.Invoke("OrderPostClose", orderId, reason), options);
}
+ public static useCancel = this.useClose;
/**
* @author Aloento
diff --git a/src/ShopNet/Order/Delete.ts b/src/ShopNet/Order/Delete.ts
index dfa31f3..1831f11 100644
--- a/src/ShopNet/Order/Delete.ts
+++ b/src/ShopNet/Order/Delete.ts
@@ -16,7 +16,7 @@ export abstract class OrderDelete extends ShopNet {
public static useDelete(options: Options) {
return useRequest(async orderId => {
this.EnsureLogin();
- const res = await this.Invoke("OrderDeleteCancel", orderId);
+ const res = await this.Invoke("OrderDeleteCancelled", orderId);
this.EnsureTrue(res);
return res;
}, options);
diff --git a/src/ShopNet/Order/Get.ts b/src/ShopNet/Order/Get.ts
index a0c26aa..9bc265f 100644
--- a/src/ShopNet/Order/Get.ts
+++ b/src/ShopNet/Order/Get.ts
@@ -78,7 +78,7 @@ export abstract class OrderGet extends OrderEntity {
/**
* @author Aloento
* @since 0.5.0
- * @version 2.1.0
+ * @version 2.2.0
*/
public static useItems(orderId: number, pLog: Logger, admin?: true) {
const log = useConst(() => pLog.With(...this.Log, "Items"));
@@ -136,15 +136,21 @@ export abstract class OrderGet extends OrderEntity {
continue;
}
- const [_, cover] = await ProductGet.PhotoList(prodId, log);
+ let cover = "";
- if (!cover)
- log.warn(`Product ${prodId} has no photo`);
+ if (!admin) {
+ const [_, res] = await ProductGet.PhotoList(prodId, log);
+
+ if (!res)
+ log.warn(`Product ${prodId} has no photo`);
+
+ cover = res;
+ }
items.push({
Id: index++,
ProdId: prodId,
- Cover: cover || "",
+ Cover: cover,
Name: prod.Name,
Type: variType,
Quantity: combo.Quantity,
diff --git a/src/ShopNet/Order/Post.ts b/src/ShopNet/Order/Post.ts
index 68f0223..ef195e6 100644
--- a/src/ShopNet/Order/Post.ts
+++ b/src/ShopNet/Order/Post.ts
@@ -47,14 +47,12 @@ export abstract class OrderPost extends ShopNet {
/**
* @author Aloento
* @since 0.5.0
- * @version 0.2.0
+ * @version 0.3.0
*/
- public static useCancel(options: Options) {
- return useRequest(async (orderId, reason) => {
+ public static useCancel(options: Options) {
+ return useRequest((orderId, reason) => {
this.EnsureLogin();
- const res = await this.Invoke("OrderPostCancel", orderId, reason);
- this.EnsureTrue(res);
- return res;
+ return this.Invoke("OrderPostCancel", orderId, reason);
}, options);
}