progress
Some checks failed
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Failing after 0s

This commit is contained in:
BOTAlex 2025-08-14 22:27:25 +02:00
parent a20a3b9cdc
commit f4453bb8fb
2 changed files with 13 additions and 2 deletions

View file

@ -3,7 +3,7 @@
import PocketBase from "pocketbase";
import { ShopItem } from "./classes/ShopItem";
import { PUBLIC_POCKET_URL, PUBLIC_ASSETS_URL_BASE } from "$env/static/public";
import { PUBLIC_POCKET_URL, PUBLIC_URL_BASE } from "$env/static/public";
export let pb = new PocketBase(PUBLIC_POCKET_URL);
@ -15,4 +15,11 @@ export class ApiService {
const list = await pb.collection("shopItems").getList(1, 50, {});
return list.items.map((rec: any) => ShopItem.fromJSON(rec));
}
static async GetShopItemFromUrlPath(url: string): Promise<ShopItem> {
const item = await pb
.collection("shopItems")
.getFirstListItem(`product_url="${url}"`);
return ShopItem.fromJSON(item);
}
}