Admin app simplification by using API auth properly. Implemented promise to keep request blocked by permission check while the user authenticates, fixing concurrent requests.

This commit is contained in:
2025-12-04 09:19:40 +00:00
parent 5aa8d021e6
commit e102b8383b
2 changed files with 25 additions and 96 deletions
+4 -3
View File
@@ -228,9 +228,10 @@ export async function apiFetch(url, options = {}) {
// If we can't parse JSON, no iframe available
}
// Authenticate via iframe (if not already in a frame, and no existing #auth-iframe)
if (authInfo?.iframe && window === window.top && !isAuthIframeOpen()) {
// Show auth iframe and wait for success (throws AuthCancelledError on cancel)
// Authenticate via iframe (only in top-level window)
if (authInfo?.iframe && window === window.top) {
// Show auth iframe (or wait for existing one) and retry on success
// showAuthIframe returns existing promise if iframe is already open
await showAuthIframe(authInfo.iframe)
continue // Retry the original request
}