Hii everyone. Fairly new to Elixir/Phoenix
Phoenix App contains 2 live pages, openings_live
and job_application
and uses github Uberauth for auth.
openings_live
serves as landing page with list of positions with buttons where user can login to GitHub,
job_application
is a form where user can apply to desire position.
In router I serve something like this:
scope "/", LandingWeb do
pipe_through :browser
...
# landing page main route
live "/", JobLive.OpeningsLive.Index, :index
end
# github auth scope
scope "/auth", LandingWeb do
pipe_through :browser
...
# job application route - protected
live_session :default, on_mount: LandingWeb.UserAuthLive do
live "/job_openings/:id/apply", JobApplicationFormLive, :index
end
# github auth routes
get "/:provider", GithubAuthController, :request
get "/:provider/callback", GithubAuthController, :callback
end
After user clicks on the login button on landing page it takes them to the GitHub page and use their profile data.
When GitHub returns the user to the landing page, it should take the user to job_application
form.
The question is, how I can preserve, between page reloads, job_id
from openings_live
so I can use it in job_application
form ? I could use session for temporary storing job_id and read it in mount() fun.
Is there better solution for this?
Thanks!
Daniel