Permalink
Browse files

5. you probably want to let people log out

  • Loading branch information...
cainlevy committed Nov 28, 2016
1 parent f52a279 commit 8aa11944512d200e8163791635223ffe07fd6d72
Showing with 21 additions and 0 deletions.
  1. +13 −0 public/application.js
  2. +8 −0 views/layout.erb
View
@@ -35,4 +35,17 @@
})
}
/*
* Integrate KeratinAuthN.logout
*/
var logoutLink = document.querySelector("a#logout");
if (logoutLink) {
logoutLink.addEventListener('click', function (e) {
e.preventDefault();
KeratinAuthN.logout()
.then(function () { window.location.href = '/'; });
})
}
})();
View
@@ -7,6 +7,14 @@
<div class="container">
<nav class="navbar navbar-dark mb-2" style="background-color: #ef07a7;">
<span class="navbar-brand">FacePage</span>
<ul class="nav navbar-nav float-xs-right">
<% if logged_in? %>
<li class="nav-item">
<a class="btn btn-info" href="#" id="logout">Log Out</a>
</li>
<% end %>
</ul>
</nav>
<%= yield %>
</div>

0 comments on commit 8aa1194

Please sign in to comment.