diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 02af858b..03161fdd 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -55,7 +55,7 @@ public function render($request, Exception $e) */ protected function unauthenticated($request, AuthenticationException $e) { - if ($request->ajax() || $request->wantsJson()) { + if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } else { return redirect()->guest('login');