mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-02-01 07:11:02 +00:00
fix: persisting is remote
This commit is contained in:
@@ -15,10 +15,15 @@ const syncDownloadSources = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (const downloadSource of response) {
|
for (const downloadSource of response) {
|
||||||
await downloadSourcesSublevel.put(downloadSource.id, downloadSource);
|
const existingDownloadSource = downloadSources.find(
|
||||||
}
|
(source) => source.id === downloadSource.id
|
||||||
|
);
|
||||||
|
|
||||||
return response;
|
await downloadSourcesSublevel.put(downloadSource.id, {
|
||||||
|
...existingDownloadSource,
|
||||||
|
...downloadSource,
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
registerEvent("syncDownloadSources", syncDownloadSources);
|
registerEvent("syncDownloadSources", syncDownloadSources);
|
||||||
|
|||||||
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
@@ -213,7 +213,7 @@ declare global {
|
|||||||
downloadSourceId?: string
|
downloadSourceId?: string
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDownloadSources: () => Promise<DownloadSource[]>;
|
getDownloadSources: () => Promise<DownloadSource[]>;
|
||||||
syncDownloadSources: () => Promise<DownloadSource[]>;
|
syncDownloadSources: () => Promise<void>;
|
||||||
|
|
||||||
/* Hardware */
|
/* Hardware */
|
||||||
getDiskFreeSpace: (path: string) => Promise<DiskUsage>;
|
getDiskFreeSpace: (path: string) => Promise<DiskUsage>;
|
||||||
|
|||||||
@@ -101,8 +101,9 @@ export function SettingsDownloadSources() {
|
|||||||
const syncDownloadSources = async () => {
|
const syncDownloadSources = async () => {
|
||||||
setIsSyncingDownloadSources(true);
|
setIsSyncingDownloadSources(true);
|
||||||
try {
|
try {
|
||||||
const sources = await window.electron.syncDownloadSources();
|
await window.electron.syncDownloadSources();
|
||||||
setDownloadSources(sources);
|
const sources = await window.electron.getDownloadSources();
|
||||||
|
setDownloadSources(sources as DownloadSource[]);
|
||||||
|
|
||||||
showSuccessToast(t("download_sources_synced_successfully"));
|
showSuccessToast(t("download_sources_synced_successfully"));
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user