diff options
Diffstat (limited to 'start/events.ts')
-rw-r--r-- | start/events.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/start/events.ts b/start/events.ts index 11e63e5..faedc29 100644 --- a/start/events.ts +++ b/start/events.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import Config from '@ioc:Adonis/Core/Config'; | 1 | import { Config } from '@adonisjs/core/config' |
2 | import Event from '@ioc:Adonis/Core/Event'; | 2 | import emitter from '@adonisjs/core/services/emitter' |
3 | import Mail from '@ioc:Adonis/Addons/Mail'; | 3 | import mail from '@adonisjs/mail/services/main' |
4 | 4 | ||
5 | /* | 5 | /* |
6 | |-------------------------------------------------------------------------- | 6 | |-------------------------------------------------------------------------- |
@@ -11,11 +11,11 @@ import Mail from '@ioc:Adonis/Addons/Mail'; | |||
11 | | boot. | 11 | | boot. |
12 | | | 12 | | |
13 | */ | 13 | */ |
14 | Event.on('forgot::password', async ({ user, token }) => { | 14 | emitter.on('forgot::password', async ({ user, token }) => { |
15 | try { | 15 | try { |
16 | // eslint-disable-next-line no-console | 16 | // eslint-disable-next-line no-console |
17 | console.log('Sending message'); | 17 | console.log('Sending message') |
18 | await Mail.send(message => { | 18 | await mail.send((message) => { |
19 | message | 19 | message |
20 | .subject('[Ferdium] Forgot Password') | 20 | .subject('[Ferdium] Forgot Password') |
21 | .to(user.email) | 21 | .to(user.email) |
@@ -24,10 +24,10 @@ Event.on('forgot::password', async ({ user, token }) => { | |||
24 | appUrl: Config.get('app.url'), | 24 | appUrl: Config.get('app.url'), |
25 | username: user.username, | 25 | username: user.username, |
26 | token, | 26 | token, |
27 | }); | 27 | }) |
28 | }); | 28 | }) |
29 | } catch (error) { | 29 | } catch (error) { |
30 | // eslint-disable-next-line no-console | 30 | // eslint-disable-next-line no-console |
31 | console.log(`Couldn't send mail: ${error}`); | 31 | console.log(`Couldn't send mail: ${error}`) |
32 | } | 32 | } |
33 | }); | 33 | }) |