openRemindPasswordModal(): Promise<void>¶
The openRemindPasswordModal
is an asynchronous method that allows to open a modal with the remind password form inside.
Returned value¶
A returned value has a type of Promise<void>
because of potential additional animations and transitions occurring while opening a modal.
Event Bus events¶
This API method dispatches the following events with the Event Bus:
- FlashMessengerApi.addFlashMessage - when the user is already logged in while opening a modal
- authentication.authorized - when the user is already authorized while opening a modal
Example¶
In this example we create a simple HTML. button. We then declare a function that makes a AuthenticationApi
call to open a remind password modal. This function is added on click event for the button whenever it is found after the page loads and turbo:load
event fires. To read more about Turbo events read the Page Manager API documentation page.
useStorefront(async (storefront) => {
const authenticationApi = await storefront.getApi('AuthenticationApi');
const handleOpenRemindPasswordModal = async (event) => {
await authenticationApi.openRemindPasswordModal();
}
document.addEventListener('turbo:load', (event) => {
const $button = document.querySelector('.btn');
$button.addEventListener('click', handleOpenRemindPasswordModal)
});
});