diff options
Diffstat (limited to 'app/Controllers/Http/Dashboard/DeleteController.ts')
-rw-r--r-- | app/Controllers/Http/Dashboard/DeleteController.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Controllers/Http/Dashboard/DeleteController.ts b/app/Controllers/Http/Dashboard/DeleteController.ts new file mode 100644 index 0000000..ef8188c --- /dev/null +++ b/app/Controllers/Http/Dashboard/DeleteController.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; | ||
2 | |||
3 | export default class DeleteController { | ||
4 | /** | ||
5 | * Display the delete page | ||
6 | */ | ||
7 | public async show({ view }: HttpContextContract) { | ||
8 | return view.render('dashboard/delete'); | ||
9 | } | ||
10 | |||
11 | /** | ||
12 | * Delete user and session | ||
13 | */ | ||
14 | public async delete({ auth, response }: HttpContextContract) { | ||
15 | auth.user?.delete(); | ||
16 | auth.use('web').logout(); | ||
17 | |||
18 | return response.redirect('/user/login'); | ||
19 | } | ||
20 | } | ||