Commit 8e7672fc authored by Joseph Silber's avatar Joseph Silber

Return JSON for unauthenticated AJAX requests

parent bd358bdc
......@@ -56,7 +56,7 @@ class Handler extends ExceptionHandler
protected function unauthenticated($request, AuthenticationException $e)
{
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
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