Skip to content
Discussion options

You must be logged in to vote

In your listener, you get the event and not the User. So it should be

import User from "#models/user";
+ import UserRegistered from '#events/user_registered'
import RegisteredUserEmailService from "#services/emails/app/registered_user_email_service";
import { inject } from "@adonisjs/core";

@inject()
export default class SendWelcomeEmail {
    constructor(protected emailService: RegisteredUserEmailService) { }
-    handle(user: User) {
-        this.emailService.welcomeEmail(user);
+    handle(event: UserRegistered) {
+        this.emailService.welcomeEmail(event.user);
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by martianmaikel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants