Search code examples
javascriptember.jsember-cliember-simple-auth

Ember Simple Auth: how to keep data in a step by step process after redirection to login route


I'm creating an app using Ember.js. This application allows to book an appointment at the doctor.

You have a booking process with a few steps.

After step 1 (booking/start), you have a screen that shows up if the user isn't connected (booking/user). On this page, I have two links: one to the login page, another one to the registration page. All steps "needs" booking controller.

The link to login is basically a link to the next step (booking/confirmation), but since user isn't logged in, he's automatically redirected to login page by AuthenticatedRouteMixin. When I log in, everything works fine, I'm connected and redirected to booking/confirmation.

BUT, I lose all the data from my booking controller. It's obvious, since login doesn't have any connection with my booking controller.

I believe this is not a pure Ember Simple Auth question, but more a general Ember.js question. Do you have any idea about how I should change the login behavior to keep the data or change the logic of the app to save the data before going to the login page, then retrieve it on booking/confirmation?

My code is available here: https://github.com/lionelrudaz/wellnow-frontend

Let me know if you need more information.


Solution

  • I found a workaround. When I enter the process, I create and save a booking object, allowing me to have an id and to save the progress at every steps.

    If you need more details, just let me know.