refactor(react/promoted_attributes): deduplicate server API typings

This commit is contained in:
Elian Doran
2025-11-23 13:15:33 +02:00
parent 891e71aec6
commit 6a126009a8
3 changed files with 9 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ import { ComponentChild, HTMLInputTypeAttribute, InputHTMLAttributes, MouseEvent
import tree from "../services/tree";
import NoteAutocomplete from "./react/NoteAutocomplete";
import ws from "../services/ws";
import { UpdateAttributeResponse } from "@triliumnext/commons";
interface Cell {
definitionAttr: FAttribute;
@@ -30,12 +31,6 @@ interface CellProps {
setCellToFocus(cell: Cell): void;
}
// TODO: Deduplicate
interface AttributeResult {
attributeId: string;
}
export default function PromotedAttributes() {
const { note, componentId } = useNoteContext();
const [ cells, setCells ] = useState<Cell[]>();
@@ -417,7 +412,7 @@ function buildPromotedAttributeLabelChangedListener({ note, cell, componentId, .
}
function updateAttribute(note: FNote, cell: Cell, componentId: string, value: string) {
return server.put<AttributeResult>(
return server.put<UpdateAttributeResponse>(
`notes/${note.noteId}/attribute`,
{
attributeId: cell.valueAttr.attributeId,