This commit is contained in:
an-lee
2024-12-10 06:43:15 +08:00
parent 04c0041357
commit 6091f14a6b
2 changed files with 10 additions and 4 deletions

View File

@@ -108,15 +108,17 @@ export class Chat extends Model<Chat> {
static async notify(chat: Chat, action: "create" | "update" | "destroy") {
if (!mainWindow.win) return;
let chatData = { id: chat?.id };
if (action !== "destroy") {
chat = await Chat.findByPk(chat.id);
chat = await Chat.findByPk(chat?.id);
chatData = chat?.toJSON() || chatData;
}
mainWindow.win.webContents.send("db-on-transaction", {
model: "Chat",
id: chat.id,
id: chatData.id,
action,
record: chat.toJSON(),
record: chatData,
});
}

View File

@@ -59,7 +59,11 @@ export class UserSetting extends Model<UserSetting> {
// update i18n
if (key === UserSettingKeyEnum.LANGUAGE) {
i18n.changeLanguage(value);
try {
await i18n.changeLanguage(value);
} catch (error) {
logger.error("UserSetting.set: changeLanguage failed", error);
}
}
}