Centralize webflow/printful clients in portal

This commit is contained in:
Dominic Ferrando
2026-07-17 14:45:37 -04:00
parent d55ca423c5
commit fde7d9a363
5 changed files with 33 additions and 13 deletions
+7
View File
@@ -0,0 +1,7 @@
import { PrintfulClient } from "@blade-and-brawn/commerce";
import { env } from "$env/dynamic/private";
export const printful = new PrintfulClient({
token: env.PRINTFUL_AUTH,
storeId: env.PRINTFUL_STORE_ID
});
+12
View File
@@ -0,0 +1,12 @@
import { WebflowClient } from "@blade-and-brawn/commerce";
import { env } from "$env/dynamic/private";
export const webflow = new WebflowClient({
siteId: env.WEBFLOW_SITE_ID,
collectionIds: {
products: env.WEBFLOW_COLLECTION_PRODUCTS_ID,
skus: env.WEBFLOW_COLLECTION_SKUS_ID,
},
token: env.WEBFLOW_AUTH,
webhookSecret: env.WEBFLOW_WEBHOOK_SECRET,
});
@@ -0,0 +1,12 @@
import { printful } from "$lib/printful";
import { webflow } from "$lib/webflow";
import type { PageServerLoad } from "./$types";
export const load = async ({ }: Parameters<PageServerLoad>[0]) => {
return {
orders: {
printful: printful.Orders.list({ forceAll: true }),
webflow: webflow.Orders.list({ forceAll: true }),
},
};
};
@@ -1,17 +1,6 @@
import { PrintfulClient, WebflowClient } from "@blade-and-brawn/commerce";
import { env } from "$env/dynamic/private";
import type { PageServerLoad } from "./$types"; import type { PageServerLoad } from "./$types";
import { printful } from "$lib/printful";
const printful = new PrintfulClient({ token: env.PRINTFUL_AUTH, storeId: env.PRINTFUL_STORE_ID }); import { webflow } from "$lib/webflow";
const webflow = new WebflowClient({
siteId: env.WEBFLOW_SITE_ID,
collectionIds: {
products: env.WEBFLOW_COLLECTION_PRODUCTS_ID,
skus: env.WEBFLOW_COLLECTION_SKUS_ID,
},
token: env.WEBFLOW_AUTH,
webhookSecret: env.WEBFLOW_WEBHOOK_SECRET,
});
export const load = async ({ }: Parameters<PageServerLoad>[0]) => { export const load = async ({ }: Parameters<PageServerLoad>[0]) => {
return { return {