mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
12 lines
318 B
TypeScript
12 lines
318 B
TypeScript
import type { HttpContext } from '@adonisjs/core/http';
|
|
import type { NextFn } from '@adonisjs/core/types/http';
|
|
|
|
export default class AdminMiddleware {
|
|
async handle(ctx: HttpContext, next: NextFn) {
|
|
if (!ctx.auth.user?.isAdmin) {
|
|
return ctx.response.redirectToNamedRoute('dashboard');
|
|
}
|
|
return next();
|
|
}
|
|
}
|