generated from liutk/owl-admin-base
处理token失败
parent
023ee3d862
commit
f4e380739d
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
|
@ -34,6 +35,10 @@ class Handler extends ExceptionHandler
|
|||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response()->json(['data'=>null,'code'=>404 , 'message' => '数据未找到,或已被删除' ], 404);
|
||||
}
|
||||
}elseif($e instanceof AuthenticationException){
|
||||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response()->json(['data'=>null,'code'=>401 , 'message' => '无效凭证,请先登录' ], 401);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue