problem: products in product group recycle existing invoice

This commit is contained in:
Bob
2024-08-07 20:21:37 +08:00
parent 2ecb4894b3
commit 9cd53e4669
2 changed files with 10 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
import { Button } from '$lib/components/ui/button/index.js';
import { ndk } from '@/ndk';
import { currentUser } from '@/stores/session';
import { NDKEvent, NDKZap } from '@nostr-dev-kit/ndk';
import { NDKZap } from '@nostr-dev-kit/ndk';
import { Terminal } from 'lucide-svelte';
import { requestProvider } from 'webln';
import QrCodeSvg from './QrCodeSvg.svelte';
@@ -50,6 +50,13 @@
console.error(error);
}
}
let previousProduct: Product;
$: if (product !== previousProduct) {
invoice = null;
previousProduct = product;
}
let open: boolean;
</script>

View File

@@ -1,20 +1,18 @@
<script lang="ts">
import { onMount } from 'svelte';
import { ndk } from '@/ndk';
import type { NDKEvent } from '@nostr-dev-kit/ndk';
import ProductCard from './ProductCard.svelte';
import { fetchEvent } from '@/event_helpers/products';
import { Product, type Rocket } from '@/event_helpers/rockets';
export let productID: string | undefined = undefined;
export let rocket: Rocket;
export let product:Product | undefined = undefined;
export let product: Product | undefined = undefined;
onMount(() => {
if (!product && productID) {
fetchEvent(productID, $ndk).then(e => product = new Product(e))
fetchEvent(productID, $ndk).then((e) => (product = new Product(e)));
}
});
</script>
{#if product}