aboutsummaryrefslogtreecommitdiffstats
path: root/app/Controllers/Http/Dashboard/DeleteController.ts
blob: ef8188c188021eda2a4682fc99cf7c1a23a14b21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';

export default class DeleteController {
  /**
   * Display the delete page
   */
  public async show({ view }: HttpContextContract) {
    return view.render('dashboard/delete');
  }

  /**
   * Delete user and session
   */
  public async delete({ auth, response }: HttpContextContract) {
    auth.user?.delete();
    auth.use('web').logout();

    return response.redirect('/user/login');
  }
}