Skip to content

Commit

Permalink
Fix accessing product details response
Browse files Browse the repository at this point in the history
  • Loading branch information
moh3a committed Sep 17, 2023
1 parent 31e0a7d commit 3c9234a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ae_sdk

## 0.4.4

### Patch Changes

- Fix accessing product details response

## 0.4.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ae_sdk",
"version": "0.4.3",
"version": "0.4.4",
"description": "A simple SDK for Aliexpress (dropshipping and affiliate) APIs.",
"private": false,
"main": "./dist/index.js",
Expand Down
11 changes: 10 additions & 1 deletion src/utils/ds_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export class DropshipperClient extends AESystemClient {
if (response.ok) {
// Fix weird AE API responses into a predefind struct
if (
response.data.aliexpress_ds_product_get_response.result
.ae_item_properties &&
(
response.data.aliexpress_ds_product_get_response.result
.ae_item_properties as any
Expand All @@ -138,6 +140,8 @@ export class DropshipperClient extends AESystemClient {
).ae_item_property;

if (
response.data.aliexpress_ds_product_get_response.result
.ae_item_sku_info_dtos &&
(
response.data.aliexpress_ds_product_get_response.result
.ae_item_sku_info_dtos as any
Expand All @@ -155,7 +159,10 @@ export class DropshipperClient extends AESystemClient {
sku.aeop_s_k_u_propertys = (sku as any).ae_sku_property_dtos;
delete (sku as any).ae_sku_property_dtos;
}
if ((sku.aeop_s_k_u_propertys[0] as any).ae_sku_property_d_t_o) {
if (
sku.aeop_s_k_u_propertys[0] &&
(sku.aeop_s_k_u_propertys[0] as any).ae_sku_property_d_t_o
) {
sku.aeop_s_k_u_propertys.forEach((prop) => {
prop = (prop as any).ae_sku_property_d_t_o;
});
Expand All @@ -164,6 +171,8 @@ export class DropshipperClient extends AESystemClient {
);

if (
response.data.aliexpress_ds_product_get_response.result
.ae_multimedia_info_dto.ae_video_dtos &&
(
response.data.aliexpress_ds_product_get_response.result
.ae_multimedia_info_dto.ae_video_dtos as any
Expand Down

0 comments on commit 3c9234a

Please sign in to comment.