dwyl / mvp

📲 simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
84 stars 2 forks source link

Chore: DRY `socket` assigns code using `AuthPlug.assign_jwt_to_socket/3` #215

Closed nelsonic closed 1 year ago

nelsonic commented 1 year ago

In light of https://github.com/dwyl/auth_plug/issues/86 we can now call:

socket = socket
  |> AuthPlug.assign_jwt_to_socket(&Phoenix.Component.assign_new/3, jwt)

Todo

https://github.com/dwyl/mvp/blob/main/BUILDIT.md#62-create-auth-controller

https://github.com/dwyl/mvp/blob/4d430b3459645ef52703b6342eca3e199ca3f75d/lib/app_web/controllers/auth_controller.ex#L5-L18

Can just be:

def on_mount(:default, _params, %{"jwt" => jwt} = _session, socket) do
  {:cont, AuthPlug.assign_jwt_to_socket(socket, &Phoenix.Component.assign_new/3, jwt)}
end

Which DRYs up this code very nicely.

nelsonic commented 1 year ago

Anyone in the community of contributors is welcome to pick this up as a good first issue. 👌

DuldR commented 1 year ago

@nelsonic Hello! I'd love to take a wack at it if this is still available.

nelsonic commented 1 year ago

Hey @DuldR 👋 This 100% still an issue. 💯 You have write access to the repo, see: https://github.com/dwyl/mvp/invitations 🦄 Please create a branch in the repo and Go for it! 🙌
(hopefully the above instructions are clear ... but if not, ask! 🙏)

P.S: visit https://github.com/dwyl to accept Org Membership invitation 📥 P.P.S: Don't forget to ⭐ the repo if you find it interesting/useful. 🌟

DuldR commented 1 year ago

Added some questions over at the PR - https://github.com/dwyl/mvp/pull/225

nelsonic commented 1 year ago

@DuldR replied to your questions in the PR: https://github.com/dwyl/mvp/pull/225#issuecomment-1335058743 Thanks again! 👌

DuldR commented 1 year ago

Thank you for the feedback! Marked ready for review.

nelsonic commented 1 year ago

Merged. Thanks again! 🎉

nelsonic commented 1 year ago

Follow-up quest: #226 / #227 (sadly this one has to be done by me cause I have to publish a new version ... 🙄)