Q:

Laravel Ajax Login Tries To Redirect

I am trying to remove default Laravel behavior of redirected authenticated user once authenticated.
I commented in LoginController.php
//protected $redirectTo = '/home'; 

And also changed the AuthenticatesUsers vendor file to return JSON instead of a redirect on login success:
protected function sendLoginResponse(Request $request)
    {
        $request->session()->regenerate();

        $this->clearLoginAttempts($request);

        /*return $this->authenticated($request, $this->guard()->user())
                ?: redirect()->intended($this->redirectPath());*/

                 return response()->json(['SUCCESS' => 'AUTHENTICATED'], 200);
    }

But still when I successfully login I see in my Chrome network tab that I get an error, because it is trying to redirect me to /home which is an undefined route, leading to the error and halting my Laravel SPA.
Why is Laravel continuing to direct me to /home even after I comment it out and change the Vendor files?

A:

It was a middleware problem.
public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            //return redirect('/home');
        }

        return $next($request);
    }

In, app/Http/Middleware/RedirectIfAuthenticated.php

