Update BaseApiController, invalidate session after account deletion

This commit is contained in:
Daniel Supernault 2020-02-19 22:53:04 -07:00
parent 3c62fa79c5
commit 826978ce08
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -314,6 +314,10 @@ class BaseApiController extends Controller
{ {
$user = $request->user(); $user = $request->user();
abort_if(!$user, 403); abort_if(!$user, 403);
if($user->status != null) {
Auth::logout();
return redirect('/login');
}
$resource = new Fractal\Resource\Item($user->profile, new AccountTransformer()); $resource = new Fractal\Resource\Item($user->profile, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
return response()->json($res); return response()->json($res);