mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-18 04:21:32 +08:00
chore(client/ts): port services/attribute_autocomplete
This commit is contained in:
parent
21ae604307
commit
39b82b4c98
@ -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) {
|
Loading…
x
Reference in New Issue
Block a user