diff options
Diffstat (limited to 'app/Middleware/SilentAuth.ts')
-rw-r--r-- | app/Middleware/SilentAuth.ts | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/Middleware/SilentAuth.ts b/app/Middleware/SilentAuth.ts index ee73ec4..a7271d5 100644 --- a/app/Middleware/SilentAuth.ts +++ b/app/Middleware/SilentAuth.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; | 1 | import { HttpContext } from '@adonisjs/core/http' |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Silent auth middleware can be used as a global middleware to silent check | 4 | * Silent auth middleware can be used as a global middleware to silent check |
@@ -10,15 +10,12 @@ export default class SilentAuthMiddleware { | |||
10 | /** | 10 | /** |
11 | * Handle request | 11 | * Handle request |
12 | */ | 12 | */ |
13 | public async handle( | 13 | public async handle({ auth }: HttpContext, next: () => Promise<void>) { |
14 | { auth }: HttpContextContract, | ||
15 | next: () => Promise<void>, | ||
16 | ) { | ||
17 | /** | 14 | /** |
18 | * Check if user is logged-in or not. If yes, then `ctx.auth.user` will be | 15 | * Check if user is logged-in or not. If yes, then `ctx.auth.user` will be |
19 | * set to the instance of the currently logged in user. | 16 | * set to the instance of the currently logged in user. |
20 | */ | 17 | */ |
21 | await auth.check(); | 18 | await auth.check() |
22 | await next(); | 19 | await next() |
23 | } | 20 | } |
24 | } | 21 | } |