Skip to content
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

Merged
merged 4 commits into from
Jan 19, 2020
Merged

Api login consistency #46

merged 4 commits into from
Jan 19, 2020

Conversation

kresnasatya
Copy link
Contributor

Halo mas, saya ada pembaharuan di route auth API pakai Laravel Passport:

  1. Menambahkan validasi ketika login
  2. Membuat route logout konsisten dengan route login di sisi path.

Copy link
Owner

@nafiesl nafiesl left a 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();
Copy link
Owner

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',
]);

Copy link
Contributor Author

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. :)

Copy link
Owner

@nafiesl nafiesl left a 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(
Copy link
Owner

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',
]

app/Http/Controllers/Api/Auth/AuthController.php Outdated Show resolved Hide resolved
Copy link
Owner

@nafiesl nafiesl left a 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.

@nafiesl nafiesl merged commit dafedec into nafiesl:master Jan 19, 2020
@kresnasatya kresnasatya deleted the api-login-consistency branch March 8, 2020 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants