chore(client/ts): port services/attribute_autocomplete

This commit is contained in:
Elian Doran 2024-12-19 19:12:42 +02:00
parent 21ae604307
commit 39b82b4c98
No known key found for this signature in database

View File

@ -20,7 +20,7 @@ function initAttributeNameAutocomplete({ $el, attributeType, open }) {
source: async (term, cb) => {
const type = typeof attributeType === "function" ? attributeType() : attributeType;
const names = await server.get(`attribute-names/?type=${type}&query=${encodeURIComponent(term)}`);
const names = await server.get<string[]>(`attribute-names/?type=${type}&query=${encodeURIComponent(term)}`);
const result = names.map(name => ({name}));
cb(result);
@ -52,7 +52,7 @@ async function initLabelValueAutocomplete({ $el, open, nameCallback }) {
return;
}
const attributeValues = (await server.get(`attribute-values/${encodeURIComponent(attributeName)}`))
const attributeValues = (await server.get<string[]>(`attribute-values/${encodeURIComponent(attributeName)}`))
.map(attribute => ({ value: attribute }));
if (attributeValues.length === 0) {