diff options
| author | Fuwn <[email protected]> | 2024-05-27 18:38:30 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-27 18:38:30 -0700 |
| commit | c4ec98bc96679586f6867870de8e00e043090354 (patch) | |
| tree | ea3abd178d2387f76b1521d316ce352f0e997335 /src/lib/User/BadgeWall/BadgePreview.svelte | |
| parent | feat(hololive): parallax image for thumbnails (diff) | |
| download | due.moe-c4ec98bc96679586f6867870de8e00e043090354.tar.xz due.moe-c4ec98bc96679586f6867870de8e00e043090354.zip | |
feat(badges): click counter for badges
Diffstat (limited to 'src/lib/User/BadgeWall/BadgePreview.svelte')
| -rw-r--r-- | src/lib/User/BadgeWall/BadgePreview.svelte | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/User/BadgeWall/BadgePreview.svelte b/src/lib/User/BadgeWall/BadgePreview.svelte index ac9519c5..4e347d3d 100644 --- a/src/lib/User/BadgeWall/BadgePreview.svelte +++ b/src/lib/User/BadgeWall/BadgePreview.svelte @@ -7,6 +7,7 @@ import { onMount } from 'svelte'; import { cubicOut } from 'svelte/easing'; import { tweened } from 'svelte/motion'; + import root from '$lib/Utility/root'; export let selectedBadge: Badge | undefined; export let onNext: () => void = () => {}; @@ -51,6 +52,13 @@ } } + $: { + if (selectedBadge) + fetch(root(`/api/badges?incrementClickCount=${selectedBadge.id}`), { + method: 'PUT' + }); + } + onMount(() => { const handleClickOutside = (event: any) => { if (event.target.classList.contains('popup')) selectedBadge = undefined; |