Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Redundant and confusing code in UserController#current_user #24

Open
mtarnovan opened this issue Aug 2, 2018 · 2 comments
Open

Redundant and confusing code in UserController#current_user #24

mtarnovan opened this issue Aug 2, 2018 · 2 comments

Comments

@mtarnovan
Copy link

mtarnovan commented Aug 2, 2018

I believe https://github.com/gothinkster/elixir-phoenix-realworld-example-app/blob/master/lib/real_world_web/controllers/user_controller.ex#L29-L35 is redundant and confusing. There is no need to check user for nil and render 404.json, as Guardian already has an error handler which will be invoked when trying to access UserController#current_user without being authenticated.

@lbighetti
Copy link
Collaborator

@mtarnovan I absolutely agree. Can you send a PR with the suggestion?
I'll merge it in ❤️

@lbighetti
Copy link
Collaborator

(sorry for the delay by the way, my first baby boy was born in August I have been away for a while)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants