mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
fix: removing async promise
This commit is contained in:
@@ -19,7 +19,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"@typescript-eslint/no-explicit-any": "warn",
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
"no-async-promise-executor": "off",
|
|
||||||
"prettier/prettier": [
|
"prettier/prettier": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const createDownloadSource = async (
|
|||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
url: string
|
url: string
|
||||||
) => {
|
) => {
|
||||||
return HydraApi.post("/profile/download-sources", {
|
await HydraApi.post("/profile/download-sources", {
|
||||||
url,
|
url,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { HydraCloudModal } from "./pages/shared-modals/hydra-cloud/hydra-cloud-m
|
|||||||
|
|
||||||
import { injectCustomCss } from "./helpers";
|
import { injectCustomCss } from "./helpers";
|
||||||
import "./app.scss";
|
import "./app.scss";
|
||||||
|
import { DownloadSource } from "@types";
|
||||||
|
|
||||||
export interface AppProps {
|
export interface AppProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -139,12 +140,15 @@ export function App() {
|
|||||||
const syncDownloadSources = useCallback(async () => {
|
const syncDownloadSources = useCallback(async () => {
|
||||||
const downloadSources = await window.electron.getDownloadSources();
|
const downloadSources = await window.electron.getDownloadSources();
|
||||||
|
|
||||||
|
const existingDownloadSources: DownloadSource[] =
|
||||||
|
await downloadSourcesTable.toArray();
|
||||||
|
|
||||||
await Promise.allSettled(
|
await Promise.allSettled(
|
||||||
downloadSources.map(async (source) => {
|
downloadSources.map(async (source) => {
|
||||||
return new Promise(async (resolve) => {
|
return new Promise((resolve) => {
|
||||||
const existingDownloadSource = await downloadSourcesTable
|
const existingDownloadSource = existingDownloadSources.find(
|
||||||
.where({ url: source.url })
|
(downloadSource) => downloadSource.url === source.url
|
||||||
.first();
|
);
|
||||||
|
|
||||||
if (!existingDownloadSource) {
|
if (!existingDownloadSource) {
|
||||||
const channel = new BroadcastChannel(
|
const channel = new BroadcastChannel(
|
||||||
@@ -160,6 +164,8 @@ export function App() {
|
|||||||
resolve(true);
|
resolve(true);
|
||||||
channel.close();
|
channel.close();
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
resolve(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user