Mike 7 năm trước cách đây
mục cha
commit
eff8112bd1

+ 4 - 4
server/app/Http/Middleware/Authenticate.php

@@ -18,10 +18,10 @@ class Authenticate
     public function handle($request, Closure $next, $guard = null)
     public function handle($request, Closure $next, $guard = null)
     {
     {
         if(Auth::guard($guard)->guest()) {
         if(Auth::guard($guard)->guest()) {
-            \Log::info($guard);
-            if($request->ajax()||$guard=="api") {
-                \Log::info('Unauthorized Unauthorized ');
-                return response('Unauthorized .', 401);
+//            \Log::info($guard);
+            if($request->ajax()||$request->wantsJson()||$guard=="api") {
+//                \Log::info('Unauthorized Unauthorized ');
+                return response('Unauthorized.', 401);
             } else {
             } else {
                 if($guard == 'admin') {
                 if($guard == 'admin') {
                     return redirect()->guest('admin/login');
                     return redirect()->guest('admin/login');