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

Update path to correct layout template in 'Channels' guide and socket.js template #5704

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion guides/real_time/channels.md
Expand Up @@ -410,7 +410,7 @@ Now our `conn.assigns` contains the `current_user` and `user_token`.

### Step 2 - Pass the Token to the JavaScript

Next, we need to pass this token to JavaScript. We can do so inside a script tag in `lib/hello_web/components/layouts/app.html.heex` right above the app.js script, as follows:
Next, we need to pass this token to JavaScript. We can do so inside a script tag in `lib/hello_web/components/layouts/root.html.heex` right above the app.js script, as follows:

```heex
<script>window.userToken = "<%= assigns[:user_token] %>";</script>
Expand Down
2 changes: 1 addition & 1 deletion priv/templates/phx.gen.socket/socket.js
Expand Up @@ -32,7 +32,7 @@ let socket = new Socket("/socket", {params: {token: window.userToken}})
// end
//
// Now you need to pass this token to JavaScript. You can do so
// inside a script tag in "<%= web_prefix %>/templates/layout/app.html.heex":
// inside a script tag in "<%= web_prefix %>/components/layouts/root.html.heex":
//
// <script>window.userToken = "<%%= assigns[:user_token] %>";</script>
//
Expand Down