Skip to content

Commit 7e1c4ea

Browse files
author
José Fernando Cordova
committed
fixed login return jsonRespone
1 parent 047c151 commit 7e1c4ea

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/Api/V1/Controllers/LoginController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public function login(LoginRequest $request, JWTAuth $JWTAuth): JsonResponse
3636
throw new HttpException(500);
3737
}
3838

39-
ApiResponse::response(200, 'Ok',
40-
['token' => $token, 'expires_in' => Auth::guard()->factory()->getTTL() * 60]);
39+
return ApiResponse::response(200, 'Ok', [
40+
'token' => $token,
41+
'expires_in' => Auth::guard()->factory()->getTTL() * 60
42+
]);
4143
}
4244
}

app/Helpers/ApiResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class ApiResponse
77
/**
88
* @param string $code
99
* @param string $message
10-
* @param null $response
10+
* @param array $response
1111
* @return \Illuminate\Http\JsonResponse
1212
*/
13-
public static function response(string $code, string $message, $response = null): JsonResponse
13+
public static function response(string $code, string $message, $response = []): JsonResponse
1414
{
1515
return response()->json(['status' => $message, 'response' => $response], $code);
1616
}

0 commit comments

Comments
 (0)