fix(accounts): refresh status before enabling accounts

Validate Real-Debrid, Mega-Debrid, and Debrid-Link accounts silently before exposing a newly enabled account to active downloads. Keep the row toggle optimistic, skip network checks while disabling, persist direct account-check results, and avoid the browser-login race for an already authenticated Real-Debrid web session.
This commit is contained in:
Sucukdeluxe
2026-08-15 21:41:38 +02:00
parent d720c5912e
commit 82303dc94a
5 changed files with 83 additions and 12 deletions
+10
View File
@@ -145,6 +145,16 @@ export async function runOptimisticAccountUpdate<T>(
}
}
export async function runAccountEnableRefresh<T>(
refresh: (() => Promise<void>) | undefined,
persist: () => Promise<T>
): Promise<T> {
if (refresh) {
await refresh();
}
return persist();
}
export function buildScopedAccountEnabledState(
currentDisabledProviders: DebridProvider[],
providerIds: DebridProvider[],