4 changed files with 55 additions and 13 deletions
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
<script> |
||||
import {onMount} from 'svelte'; |
||||
import { useTinyRouter } from 'svelte-tiny-router'; |
||||
|
||||
import { api } from '../../urls.svelte.js'; |
||||
import { t } from '../../translations.svelte.js'; |
||||
|
||||
let { tag } = $props(); |
||||
let error = $state(null); |
||||
let uses = $state(null); |
||||
|
||||
async function loadUses(){ |
||||
const url = api(`tags/uses/${tag}`); |
||||
const resp = await fetch(api,{credentials:'include'}); |
||||
if (resp.ok){ |
||||
uses = await resp.json; |
||||
error = null; |
||||
} else { |
||||
error = await resp.text(); |
||||
} |
||||
} |
||||
|
||||
onMount(loadUses); |
||||
</script> |
||||
<fieldset> |
||||
<legend>{t('tag_uses',{tag:tag})}</legend> |
||||
{#if error} |
||||
<span class="error">{error}</span> |
||||
{/if} |
||||
</fieldset> |
||||
Loading…
Reference in new issue