chore(prettier): fix all files

This commit is contained in:
Elian Doran
2025-01-09 18:07:02 +02:00
parent 19ee861699
commit 4cbb529fd4
571 changed files with 23226 additions and 23940 deletions

View File

@@ -6,7 +6,7 @@ import appContext from "../components/app_context.js";
import { t } from "./i18n.js";
export async function uploadFiles(entityType: string, parentNoteId: string, files: string[], options: Record<string, string | Blob>) {
if (!['notes', 'attachments'].includes(entityType)) {
if (!["notes", "attachments"].includes(entityType)) {
throw new Error(`Unrecognized import entity type '${entityType}'.`);
}
@@ -21,9 +21,9 @@ export async function uploadFiles(entityType: string, parentNoteId: string, file
counter++;
const formData = new FormData();
formData.append('upload', file);
formData.append('taskId', taskId);
formData.append('last', counter === files.length ? "true" : "false");
formData.append("upload", file);
formData.append("taskId", taskId);
formData.append("last", counter === files.length ? "true" : "false");
for (const key in options) {
formData.append(key, options[key]);
@@ -33,14 +33,14 @@ export async function uploadFiles(entityType: string, parentNoteId: string, file
url: `${window.glob.baseApiUrl}notes/${parentNoteId}/${entityType}-import`,
headers: await server.getHeaders(),
data: formData,
dataType: 'json',
type: 'POST',
dataType: "json",
type: "POST",
timeout: 60 * 60 * 1000,
error: function (xhr) {
toastService.showError(t("import.failed", { message: xhr.responseText }));
},
contentType: false, // NEEDED, DON'T REMOVE THIS
processData: false, // NEEDED, DON'T REMOVE THIS
processData: false // NEEDED, DON'T REMOVE THIS
});
}
}
@@ -54,17 +54,17 @@ function makeToast(id: string, message: string): ToastOptions {
};
}
ws.subscribeToMessages(async message => {
if (message.taskType !== 'importNotes') {
ws.subscribeToMessages(async (message) => {
if (message.taskType !== "importNotes") {
return;
}
if (message.type === 'taskError') {
if (message.type === "taskError") {
toastService.closePersistent(message.taskId);
toastService.showError(message.message);
} else if (message.type === 'taskProgressCount') {
} else if (message.type === "taskProgressCount") {
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
} else if (message.type === 'taskSucceeded') {
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("import.successful"));
toast.closeAfter = 5000;
@@ -76,17 +76,17 @@ ws.subscribeToMessages(async message => {
}
});
ws.subscribeToMessages(async message => {
if (message.taskType !== 'importAttachments') {
ws.subscribeToMessages(async (message) => {
if (message.taskType !== "importAttachments") {
return;
}
if (message.type === 'taskError') {
if (message.type === "taskError") {
toastService.closePersistent(message.taskId);
toastService.showError(message.message);
} else if (message.type === 'taskProgressCount') {
} else if (message.type === "taskProgressCount") {
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
} else if (message.type === 'taskSucceeded') {
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("import.successful"));
toast.closeAfter = 5000;
@@ -95,7 +95,7 @@ ws.subscribeToMessages(async message => {
if (message.result.parentNoteId) {
await appContext.tabManager.getActiveContext().setNote(message.result.importedNoteId, {
viewScope: {
viewMode: 'attachments'
viewMode: "attachments"
}
});
}