Centralize webflow/printful clients in portal
This commit is contained in:
@@ -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
|
||||
});
|
||||
@@ -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";
|
||||
|
||||
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<PageServerLoad>[0]) => {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user