fix: show names in admin tag panel
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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]) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
export let data;
|
||||
export let form;
|
||||
console.log(data)
|
||||
|
||||
let activeTab = 'users';
|
||||
let editingTagId: string | null = null;
|
||||
|
||||
Reference in New Issue
Block a user