JS challenge cannot be shown on SPA website

I have a website developed with Angaulr for the client and .Net core for the server. On some actions my users receive the JS challenge from CF at which point they are unable to complete the action they were trying to do.
I tried searching for ways to handle the response and execute the script so the user could be allowed for his action but I seem to be unable to execute it.
My last attempt was to intercept that response and write as HTML to the document like so:

 if (respError.headers.has('cf-mitigated') && respError.headers.get('cf-mitigated') === 'challenge') {

and on the service:

export class CloudflareService {

  constructor() { }

  showChallenge(blob: Blob): void {
      .then(html => { window.document.write(html); })
      .catch(e => console.error(e));

But this results in an error.
Has anyone been able to work with JS challenge in a SPA webstite or can someone suggest a way to handle it?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.