mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 23:29:55 +01:00
refactor(react/promoted_attributes): deduplicate server API typings
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user