-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api login consistency #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sedikit masukan mas, mungkin bisa mas pertimbangkan?
public function login(Request $request) | ||
{ | ||
$this->validator($request->all())->validate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mas @satyakresna, kenapa kita ngga pakai request validator aja disini mas?
$request->validate([
'email' => 'required|string|email',
'password' => 'required|string',
]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh iya juga ya. Saya perbaiki. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dikit lagi revisi kecil mas.
@@ -32,6 +38,8 @@ public function logout() | |||
$token->revoke(); | |||
}); | |||
|
|||
return response()->json('Logged out successfully', 200); | |||
return response()->json(array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mas @satyakresna kita pakai array yang kekinian aja mas:
[
'message' => 'Logged out successfully',
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sip, tested working well on my localhost.
Thanks, mas @satyakresna.
Halo mas, saya ada pembaharuan di route auth API pakai Laravel Passport:
logout
konsisten dengan routelogin
di sisi path.