more cleanup

This commit is contained in:
Dominic Ferrando
2026-06-14 14:19:46 -04:00
parent 05dc26adb5
commit 5bb762961a
5 changed files with 42 additions and 48 deletions
+4
View File
@@ -3,6 +3,10 @@
"module": "index.ts",
"type": "module",
"private": true,
"scripts": {
"dev": "bun run --hot src/index.ts",
"start": "bun run src/index.ts"
},
"dependencies": {
"@elysiajs/cors": "^1.4.2",
"elysia": "^1.4.28",
+10 -8
View File
@@ -1,17 +1,16 @@
<script lang="ts">
import type { Printful } from "@blade-and-brawn/commerce";
import { PUBLIC_API_URL } from "$env/static/public";
import { onMount } from "svelte";
const { data } = $props();
const apiUrl = "http://localhost:3000";
const synchronizer = $state({
isSyncing: false,
syncingIds: [] as number[],
poll: async function () {
const res = (await (
await fetch(`${apiUrl}/products/sync`)
await fetch(`${PUBLIC_API_URL}/products/sync`)
).json()) as any;
if (res.data) {
synchronizer.isSyncing = res.data.isSyncing;
@@ -26,13 +25,16 @@
},
syncAll: async () => {
synchronizer.startPolling();
await fetch(`${apiUrl}/products/sync`, { method: "POST" });
await fetch(`${PUBLIC_API_URL}/products/sync`, { method: "POST" });
},
sync: async (printfulProductId: number) => {
synchronizer.startPolling();
await fetch(`${apiUrl}/products/sync/${printfulProductId}`, {
method: "POST",
});
await fetch(
`${PUBLIC_API_URL}/products/sync/${printfulProductId}`,
{
method: "POST",
},
);
},
});
@@ -84,7 +86,7 @@
onclick={async () => {
const productData = (await (
await fetch(
`${apiUrl}/products/${printfulProduct.id}`,
`${PUBLIC_API_URL}/products/${printfulProduct.id}`,
)
).json()) as any;
console.log(productData);