diff --git a/apps/client/src/services/i18n.ts b/apps/client/src/services/i18n.ts index 80a9d6458..25c98fe39 100644 --- a/apps/client/src/services/i18n.ts +++ b/apps/client/src/services/i18n.ts @@ -2,7 +2,7 @@ import options from "./options.js"; import i18next from "i18next"; import i18nextHttpBackend from "i18next-http-backend"; import server from "./server.js"; -import type { Locale } from "../../../services/i18n.js"; +import type { Locale } from "@triliumnext/commons"; let locales: Locale[] | null; diff --git a/apps/client/src/widgets/bookmark_switch.ts b/apps/client/src/widgets/bookmark_switch.ts index 8ec8b88b5..93d4789aa 100644 --- a/apps/client/src/widgets/bookmark_switch.ts +++ b/apps/client/src/widgets/bookmark_switch.ts @@ -35,7 +35,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget { async toggle(state: boolean | null | undefined) { const resp = await server.put(`notes/${this.noteId}/toggle-in-parent/_lbBookmarks/${!!state}`); - if (!resp.success) { + if (!resp.success && "message" in resp) { toastService.showError(resp.message); } } diff --git a/apps/client/src/widgets/buttons/attachments_actions.ts b/apps/client/src/widgets/buttons/attachments_actions.ts index b8bbbe572..8b904d658 100644 --- a/apps/client/src/widgets/buttons/attachments_actions.ts +++ b/apps/client/src/widgets/buttons/attachments_actions.ts @@ -8,9 +8,9 @@ import appContext from "../../components/app_context.js"; import openService from "../../services/open.js"; import utils from "../../services/utils.js"; import { Dropdown } from "bootstrap"; -import type attachmentsApiRoute from "../../../../routes/api/attachments.js"; import type FAttachment from "../../entities/fattachment.js"; import type AttachmentDetailWidget from "../attachment_detail.js"; +import { NoteRow } from "@triliumnext/commons"; const TPL = /*html*/` `; +// TODO: Deduplicate +interface AttachmentResponse { + note: NoteRow; +} + export default class AttachmentActionsWidget extends BasicWidget { $uploadNewRevisionInput!: JQuery; attachment: FAttachment; @@ -168,7 +173,7 @@ export default class AttachmentActionsWidget extends BasicWidget { return; } - const { note: newNote } = await server.post>(`attachments/${this.attachmentId}/convert-to-note`); + const { note: newNote } = await server.post(`attachments/${this.attachmentId}/convert-to-note`); toastService.showMessage(t("attachments_actions.convert_success", { title: this.attachment.title })); await ws.waitForMaxKnownEntityChangeId(); await appContext.tabManager.getActiveContext()?.setNote(newNote.noteId); diff --git a/apps/client/src/widgets/note_icon.ts b/apps/client/src/widgets/note_icon.ts index 6dd1fdebf..b5623db87 100644 --- a/apps/client/src/widgets/note_icon.ts +++ b/apps/client/src/widgets/note_icon.ts @@ -207,7 +207,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget { async getIconToCountMap() { if (!this.iconToCountCache) { - this.iconToCountCache = server.get("other/icon-usage"); + this.iconToCountCache = server.get("other/icon-usage"); setTimeout(() => (this.iconToCountCache = null), 20000); // invalidate cache after 20 seconds } diff --git a/apps/client/src/widgets/note_language.ts b/apps/client/src/widgets/note_language.ts index 4f5d2dc63..45fcf02c9 100644 --- a/apps/client/src/widgets/note_language.ts +++ b/apps/client/src/widgets/note_language.ts @@ -5,7 +5,7 @@ import { t } from "i18next"; import type { EventData } from "../components/app_context.js"; import type FNote from "../entities/fnote.js"; import attributes from "../services/attributes.js"; -import type { Locale } from "../../../services/i18n.js"; +import type { Locale } from "@triliumnext/commons"; import options from "../services/options.js"; import appContext from "../components/app_context.js";