latest
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
<input id="sidebar" type="checkbox" class="drawer-toggle" />
|
||||
<div class="drawer-content p-10 flex flex-col items-center">
|
||||
{@render children?.()}
|
||||
<label for="sidebar" class="btn btn-primary drawer-button lg:hidden">
|
||||
Open drawer
|
||||
</label>
|
||||
<!-- <label for="sidebar" class="btn btn-primary drawer-button lg:hidden"> -->
|
||||
<!-- Open drawer -->
|
||||
<!-- </label> -->
|
||||
</div>
|
||||
<div class="drawer-side">
|
||||
<label for="sidebar" aria-label="close sidebar" class="drawer-overlay"
|
||||
|
||||
@@ -2,30 +2,11 @@ import { Printful } from '$lib/services/commerce/printful';
|
||||
import { Webflow } from '$lib/services/commerce/webflow';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
const productsStore = {
|
||||
cache: {
|
||||
printful: undefined as Printful.Products.SyncProduct["sync_product"][] | undefined,
|
||||
webflow: undefined as Webflow.Products.Product[] | undefined,
|
||||
},
|
||||
getPrintfulProducts: async () => {
|
||||
if (!productsStore.cache.printful) {
|
||||
productsStore.cache.printful = await Printful.Products.getAll()
|
||||
}
|
||||
return productsStore.cache.printful;
|
||||
},
|
||||
getWebflowProducts: async () => {
|
||||
if (!productsStore.cache.webflow) {
|
||||
productsStore.cache.webflow = await Webflow.Products.getAll()
|
||||
}
|
||||
return productsStore.cache.webflow;
|
||||
}
|
||||
};
|
||||
|
||||
export const load = async ({ }: Parameters<PageServerLoad>[0]) => {
|
||||
return {
|
||||
products: {
|
||||
printful: productsStore.getPrintfulProducts(),
|
||||
webflow: productsStore.getWebflowProducts(),
|
||||
printful: Printful.Products.getAll(),
|
||||
webflow: Webflow.Products.getAll(),
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { Printful } from "$lib/services/commerce/printful.js";
|
||||
import { Printful } from "$lib/services/commerce/printful";
|
||||
|
||||
const { data } = $props();
|
||||
|
||||
let isSyncing = $state(false);
|
||||
|
||||
const isPrintfulProductSynced = async (
|
||||
printfulProduct: Printful.Products.SyncProduct["sync_product"],
|
||||
printfulProduct: Printful.Products.SyncProduct,
|
||||
) => {
|
||||
const webflowProducts = await data.products.webflow;
|
||||
return webflowProducts.some(
|
||||
(p) => p.id === printfulProduct.external_id,
|
||||
(p) => p.product.id === printfulProduct.external_id,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user