Commit b7875865 authored by Taylor Otwell's avatar Taylor Otwell

expects json

parent 51addd6c
...@@ -55,7 +55,7 @@ class Handler extends ExceptionHandler ...@@ -55,7 +55,7 @@ class Handler extends ExceptionHandler
*/ */
protected function unauthenticated($request, AuthenticationException $e) protected function unauthenticated($request, AuthenticationException $e)
{ {
if ($request->ajax() || $request->wantsJson()) { if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401); return response()->json(['error' => 'Unauthenticated.'], 401);
} else { } else {
return redirect()->guest('login'); return redirect()->guest('login');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment