Redirect back with the previous method/request



I handle user registration/login, I want the user to be able to register/login/logout pretty much everywhere.
I’m struggling how to handle it though, for example, the user wants to login, he clicks on “login”, the login modal pop, the user fill it properly and hit “send”.
It calls this:'/login', 'AuthController.login')

The controller:

'use strict'

class AuthController {
	async login({ request, auth, response }) {
        const { email, password } = request.all()
        try {
            await auth
                .attempt(email, password)
        } catch (error) {
            // Handle login errors

        return response.redirect('back')

    async logout({ auth, response }) {
        await auth.logout()
        return response.redirect('back')

module.exports = AuthController

Has you can see for now I’m using redirect('back') which call back the previous controller.function with the method get. Though sometimes the controller can’t be access with the get method because it needs request params to work properly.

I don’t know how I should handle that.
When I return only and reload the page manually it works fine, I just don’t know how to do it properly in Adonis way.

EDIT: if the right way to do this is to handle the get request as well, I can do it by saving the request params somewhere and load them if I access this controller with get, I just want to be sure to do the right thing