update
This commit is contained in:
+6
-7
@@ -123,12 +123,12 @@ export namespace Webflow {
|
|||||||
"Authorization": `bearer ${Bun.env.WEBFLOW_AUTH}`
|
"Authorization": `bearer ${Bun.env.WEBFLOW_AUTH}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const product = await getProductResponse.json();
|
const webflowProduct = await getProductResponse.json();
|
||||||
|
|
||||||
for (let i = 0; i < product["skus"].length; ++i) {
|
for (let i = 0; i < webflowProduct["skus"].length; ++i) {
|
||||||
const webflowSkuId = variantExternalIds[i];
|
const webflowSkuId = variantExternalIds[i];
|
||||||
|
|
||||||
await fetch(`${API_URL}/products/${webflowProductId}/skus/${webflowSkuId}`, {
|
const res = await fetch(`${API_URL}/products/${webflowProductId}/skus/${webflowSkuId}`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -138,11 +138,8 @@ export namespace Webflow {
|
|||||||
"sku": webflowVariants[i]
|
"sku": webflowVariants[i]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
console.log(JSON.stringify((await res.json())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
"updateProduct": updateProductResponse,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createProduct(printfulProduct: Printful.Products.SyncProduct, productRecords: ProductRecords) {
|
export async function createProduct(printfulProduct: Printful.Products.SyncProduct, productRecords: ProductRecords) {
|
||||||
@@ -248,8 +245,10 @@ export namespace Webflow {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
modifyPrintfulProductResponse = await modifyPrintfulProductResponse.json();
|
modifyPrintfulProductResponse = await modifyPrintfulProductResponse.json();
|
||||||
|
console.log(JSON.stringify(modifyPrintfulProductResponse));
|
||||||
|
|
||||||
// CACHE WEBFLOW/PRINTFUL PRODUCT ASSOCIATION
|
// CACHE WEBFLOW/PRINTFUL PRODUCT ASSOCIATION
|
||||||
productRecords.add({ printfulProductId, webflowProductId });
|
productRecords.add({ printfulProductId, webflowProductId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user