lundi 25 mars 2019

How to redirect an Ember page without rendering?

We have an Ember UI that we're porting to a Single Sign-on provider. This is behind a server-side feature flag such that, when the flag is on, the user is redirected to the SSO provider login portal and, when the flag is off, the user may still login through an Ember route.

I have this functioning with a call to a server endpoint in the Ember Service init() call. However, since this is an asynchronous call, the page continues rendering before the request returns, the results processed and the browser redirected. Thus, the user can briefly see the old login form before being redirected to the SSO portal. I would prefer that the user only see a blank browser window before the SSO portal is shown.

Is there a way to get the Service init() method to block on the results of a server call?

The application is structured somewhat oddly. The Login pages are actually a separate app, so I can hook anywhere in the application code without worrying about breaking the actual app. I have tried also hooking into the Application and only calling the Ember.Application.create() method from inside the server call promise resolution. However, it seems that loading the login page components at all triggers their render.




Aucun commentaire:

Enregistrer un commentaire