April 2018
Beginner to intermediate
406 pages
9h 33m
English
Right now it's actually difficult to navigate to the user's profile page to actually be able to generate our API key, so we'll take a quick sidebar to implement that. We'll start off by returning to the main application layout, lib/vocial_web/templates/layout/app.html.eex and modify the render call for _nav.html to pass in the conn:
<%= render "_nav.html", conn: @conn %>
Then we'll hop over to the _nav.html.eex template, where we'll change the login link to instead be conditional based on information that should be in the session:
<%= if user = Plug.Conn.get_session(@conn, :user) do %> <li><%= link "Welcome #{user.username}", to: user_path(@conn, :show, user.id) %></li> ...