Skip to content

authentication.registered

authentication.registered is an event on the Event Bus that occurs after a user registers.

Event body

none

Example

In this example we listen to authentication.registered event and perform an action whenever it's emitted.

useStorefront(async (storefront) => {
    storefront.eventBus.on('authentication.registered', () => {
        console.log('A user has registered!')
    });
});

Example

In this example we use a Message Storage API to retrieve an array of past authentication.registered events.

useStorefront((storefront) => {
    const messageStorageApi = storefront.getApiSync('messageStorageSystemApi');

    const pastRegisteredEvents = messageStorageApi.getChannelMessages('authentication.registered');

    if (pastRegisteredEvents.length > 0) {
        pastRegisteredEvents.forEach(({ body: eventBody }) => {
            console.log('perform action on every past event');
        });
    }
});

JS API reference