diff --git a/src/main/events/download-sources/add-download-source.ts b/src/main/events/download-sources/add-download-source.ts index ee426a82..bea009cb 100644 --- a/src/main/events/download-sources/add-download-source.ts +++ b/src/main/events/download-sources/add-download-source.ts @@ -11,7 +11,7 @@ const addDownloadSource = async ( try { const existingSources = await downloadSourcesSublevel.values().all(); const urlExists = existingSources.some((source) => source.url === url); - + if (urlExists) { throw new Error("Download source with this URL already exists"); } diff --git a/src/main/main.ts b/src/main/main.ts index f2440b9f..ffb8f8a9 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -53,10 +53,8 @@ export const loadState = async () => { await HydraApi.setupApi().then(async () => { uploadGamesBatch(); void migrateDownloadSources(); - - const { syncDownloadSourcesFromApi } = await import( - "./services/user" - ); + + const { syncDownloadSourcesFromApi } = await import("./services/user"); void syncDownloadSourcesFromApi(); // WSClient.connect(); }); diff --git a/src/main/services/user/index.ts b/src/main/services/user/index.ts index b5001f7a..b1d8c9b7 100644 --- a/src/main/services/user/index.ts +++ b/src/main/services/user/index.ts @@ -1,3 +1,2 @@ export * from "./get-user-data"; export * from "./sync-download-sources"; - diff --git a/src/main/services/user/sync-download-sources.ts b/src/main/services/user/sync-download-sources.ts index c5695d68..ff9819ce 100644 --- a/src/main/services/user/sync-download-sources.ts +++ b/src/main/services/user/sync-download-sources.ts @@ -39,4 +39,3 @@ export const syncDownloadSourcesFromApi = async () => { logger.error("Failed to sync download sources from API:", error); } }; - diff --git a/src/renderer/src/pages/settings/add-download-source-modal.tsx b/src/renderer/src/pages/settings/add-download-source-modal.tsx index d96c67a5..af6f8b4d 100644 --- a/src/renderer/src/pages/settings/add-download-source-modal.tsx +++ b/src/renderer/src/pages/settings/add-download-source-modal.tsx @@ -57,10 +57,11 @@ export function AddDownloadSourceModal({ onAddDownloadSource(); } catch (error) { logger.error("Failed to add download source:", error); - const errorMessage = error instanceof Error && error.message.includes("already exists") - ? t("download_source_already_exists") - : t("failed_add_download_source"); - + const errorMessage = + error instanceof Error && error.message.includes("already exists") + ? t("download_source_already_exists") + : t("failed_add_download_source"); + setError("url", { type: "server", message: errorMessage,