diff --git a/apps/portal/src/lib/printful.ts b/apps/portal/src/lib/printful.ts new file mode 100644 index 0000000..783df2f --- /dev/null +++ b/apps/portal/src/lib/printful.ts @@ -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 +}); diff --git a/apps/portal/src/lib/webflow.ts b/apps/portal/src/lib/webflow.ts new file mode 100644 index 0000000..245866b --- /dev/null +++ b/apps/portal/src/lib/webflow.ts @@ -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, +}); diff --git a/apps/portal/src/routes/(app)/apparel/orders/+page.server.ts b/apps/portal/src/routes/(app)/apparel/orders/+page.server.ts new file mode 100644 index 0000000..dac4cb6 --- /dev/null +++ b/apps/portal/src/routes/(app)/apparel/orders/+page.server.ts @@ -0,0 +1,12 @@ +import { printful } from "$lib/printful"; +import { webflow } from "$lib/webflow"; +import type { PageServerLoad } from "./$types"; + +export const load = async ({ }: Parameters[0]) => { + return { + orders: { + printful: printful.Orders.list({ forceAll: true }), + webflow: webflow.Orders.list({ forceAll: true }), + }, + }; +}; diff --git a/apps/portal/src/routes/(app)/apparel/orders/+page.svelte b/apps/portal/src/routes/(app)/apparel/orders/+page.svelte new file mode 100644 index 0000000..e69de29 diff --git a/apps/portal/src/routes/(app)/apparel/products/+page.server.ts b/apps/portal/src/routes/(app)/apparel/products/+page.server.ts index 701e29a..1276095 100644 --- a/apps/portal/src/routes/(app)/apparel/products/+page.server.ts +++ b/apps/portal/src/routes/(app)/apparel/products/+page.server.ts @@ -1,17 +1,6 @@ -import { PrintfulClient, WebflowClient } from "@blade-and-brawn/commerce"; -import { env } from "$env/dynamic/private"; import type { PageServerLoad } from "./$types"; - -const printful = new PrintfulClient({ token: env.PRINTFUL_AUTH, storeId: env.PRINTFUL_STORE_ID }); -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, -}); +import { printful } from "$lib/printful"; +import { webflow } from "$lib/webflow"; export const load = async ({ }: Parameters[0]) => { return {