This commit is contained in:
Dominic Ferrando
2025-10-13 14:55:51 -04:00
parent 7f0a51d34c
commit ba9354fede
8 changed files with 331 additions and 195 deletions
+10 -3
View File
@@ -41,8 +41,8 @@ export default class PrintfulService {
});
if (!res.ok) {
console.error("Printful product update failed:", res.statusText);
throw new Error("Failed to update Printful product");
console.error("Printful product get failed:", await res.json());
throw new Error("Failed to get Printful product");
}
const payload: Printful.Products.MetaDataSingle<Printful.Products.Product> = await res.json();
@@ -60,11 +60,18 @@ export default class PrintfulService {
});
if (!res.ok) {
console.error("Printful product update failed:", res.statusText);
console.error("Printful product update failed:", await res.json());
throw new Error("Failed to update Printful product");
}
}
}
static Util = class {
static getVariantMainImage(syncVariant: Printful.Products.SyncVariant): string {
const previewFile = syncVariant.files.find(f => f.type === "preview");
return previewFile?.preview_url ?? syncVariant.product.image;
}
}
}
export const env = () => {