Fix infinitely nested login iframes when the restricted app notices it needs login.
This commit is contained in:
@@ -228,16 +228,11 @@ export async function apiFetch(url, options = {}) {
|
|||||||
// If we can't parse JSON, no iframe available
|
// If we can't parse JSON, no iframe available
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authInfo?.iframe) {
|
// Authenticate via iframe (if not already in a frame, and no existing #auth-iframe)
|
||||||
// If an auth iframe is already open (from app or another request), don't open another
|
if (authInfo?.iframe && window === window.top && !isAuthIframeOpen()) {
|
||||||
// Just return the response so the caller can handle it
|
|
||||||
if (isAuthIframeOpen()) {
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
// Show auth iframe and wait for success (throws AuthCancelledError on cancel)
|
// Show auth iframe and wait for success (throws AuthCancelledError on cancel)
|
||||||
await showAuthIframe(authInfo.iframe)
|
await showAuthIframe(authInfo.iframe)
|
||||||
// Loop to retry the original request
|
continue // Retry the original request
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user