fix: show names in admin tag panel

This commit is contained in:
Marcel
2026-03-15 21:08:06 +00:00
parent c2625657e2
commit 62189d8bb3
3 changed files with 5 additions and 10 deletions

View File

@@ -59,11 +59,8 @@ public class TagController {
}
@GetMapping
public List<String> searchTags(@RequestParam(defaultValue = "") String query) {
return tagRepository.findByNameContainingIgnoreCase(query)
.stream()
.map(Tag::getName)
.toList();
public List<Tag> searchTags(@RequestParam(defaultValue = "") String query) {
return tagRepository.findByNameContainingIgnoreCase(query);
}
}

View File

@@ -14,12 +14,12 @@
return;
}
try {
console.log('fetch tags')
const res = await fetch(`/api/tags?query=${encodeURIComponent(query)}`);
if (res.ok) {
const data = await res.json();
// Filter out tags already selected
suggestions = data.filter((t: string) => !tags.includes(t));
// API returns Tag objects with { id, name }
const names: string[] = data.map((t: { name: string }) => t.name);
suggestions = names.filter((t) => !tags.includes(t));
showSuggestions = true;
}
} catch (e) {
@@ -43,7 +43,6 @@
}
function handleKeydown(e: KeyboardEvent) {
console.log("keydown",e)
if (e.key === 'Enter') {
e.preventDefault();
if (activeIndex >= 0 && suggestions[activeIndex]) {

View File

@@ -4,7 +4,6 @@
export let data;
export let form;
console.log(data)
let activeTab = 'users';
let editingTagId: string | null = null;