2 years ago

Promise-based login modal

Posted 2 years ago by Demers94


I'm using a VueJS component to show a modal and submit the form asynchronously when the users want to log in to my application.

In another page, there is a button that allows a user to do an action (apply on a job opening). When they click that button, a modal is opened and allows the user to select the resume that they want to use for the application. However, they must be logged in to do that.

What I would like to do is, when the user tries to apply while logged out :

1 - Show the login modal with a message that explains that they must log in to their account first in order to apply 2 - When the login is submitted and validated, and the user authenticated, show the first modal (where they can select their resume) without having to click on the button again.

I'm thinking that a promise-base approach would make sense here, but I really don't know where to start. I'm just not sure how to achieve this without relying on a lot of events everywhere, since there might be multiple scenarios where I want this functionnality.

Has anyone does this with VueJS and could help me get started? I try to find some code examples but I haven't seen anything that would work in this case.

Thanks a lot for the help!

Please sign in or create an account to participate in this conversation.