Services refactor
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
import { PrintfulService, WebflowService } from "@blade-and-brawn/commerce";
|
||||
import { PrintfulClient, WebflowClient } from "@blade-and-brawn/commerce";
|
||||
import {
|
||||
PRINTFUL_AUTH,
|
||||
PRINTFUL_STORE_ID,
|
||||
WEBFLOW_SITE_ID,
|
||||
WEBFLOW_COLLECTION_ID,
|
||||
WEBFLOW_AUTH,
|
||||
WEBFLOW_WEBHOOK_SECRET,
|
||||
} from "$env/static/private";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
|
||||
const printful = new PrintfulClient({ token: PRINTFUL_AUTH, storeId: PRINTFUL_STORE_ID });
|
||||
const webflow = new WebflowClient({
|
||||
siteId: WEBFLOW_SITE_ID,
|
||||
collectionsId: WEBFLOW_COLLECTION_ID,
|
||||
token: WEBFLOW_AUTH,
|
||||
webhookSecret: WEBFLOW_WEBHOOK_SECRET,
|
||||
});
|
||||
|
||||
export const load = async ({}: Parameters<PageServerLoad>[0]) => {
|
||||
return {
|
||||
products: {
|
||||
printful: PrintfulService.Products.getAll(),
|
||||
webflow: WebflowService.Products.getAll(),
|
||||
printful: printful.Products.getAll(),
|
||||
webflow: webflow.Products.getAll(),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user