implemented bookmark search

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-19 09:29:42 +02:00
parent 91147d736d
commit ab3060c2e2
6 changed files with 55 additions and 5 deletions

View File

@@ -4,8 +4,11 @@
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
import Bookmark from '../bookmark/Template.svelte';
const router = useTinyRouter();
console.log(router);
let bookmarks = $state(null);
let fulltext = false;
let key = $state(router.getQueryParam('key'));
let input = $state(router.getQueryParam('key'));
@@ -37,6 +40,8 @@
async function handleBookmarks(resp){
if (resp.ok){
bookmarks = await resp.json();
console.log(bookmarks);
} else {
error = await resp.text();
}
@@ -63,11 +68,17 @@
<button type="submit">{t('go')}</button>
</form>
</fieldset>
{#if key}
{#if bookmarks}
<fieldset>
<legend>
{t('results')}
{t('bookmarks')}
</legend>
{key}
<ul>
{#each Object.values(bookmarks) as bookmark}
<li>
<a href={bookmark.url} target="_blank">{@html bookmark.comment.rendered}</a>
</li>
{/each}
</ul>
</fieldset>
{/if}