I have the following Logout link in my app, but when i click on it, it does not do anything.
<li class="nav-item">
<%= link "Logout", to: session_path(@conn, :delete), method: :delete, class: "nav-link" %>
</li>
The html element the above code generates is
<li class="nav-item">
<form action="/logout" class="link" method="post">
<input name="_method" type="hidden" value="delete">
<input name="_csrf_token" type="hidden" value="GiA4JANYN10+JQhfUgIEARxZCRIEAAAUijC25v5Kj8j7KI6qrOtv==">
<a data-submit="parent" href="#">Logout</a>
</form>
</li>
Does anyone see anything obviously wrong here that the logout link would not do anything when clicked?
brunch-config.js
javascripts: {
joinTo: {
"js/app.js": /^(web\/static\/js)/,
"js/jquery-ujs.js.js": ["web/static/vendor/js/jquery-ujs.js.js"],
"js/jquery.js": ["web/static/vendor/js/jquery.js"]
},
...
I believe that the code that is responsible for handling such cases is in the phoenix_html
package's js file so you need to make sure you have added this package to mix
and have the following line in your app.js file uncommented:
import "deps/phoenix_html/web/static/js/phoenix_html"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With