Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61 from bogdan-sava/dev
Browse files Browse the repository at this point in the history
add logout server side
  • Loading branch information
bogdan-sava authored Jan 8, 2021
2 parents c13943e + ebb44ee commit 30f83f6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/user-options-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class UserOptions extends PolymerElement {
}
</style>
<token-ajax id="userAjax" last-response="{{user}}" url="/api/users/current" auto></token-ajax>
<div style="float: right">
<paper-menu-button horizontal-align="right"
horizontal-offset="20"
Expand All @@ -51,7 +52,8 @@ class UserOptions extends PolymerElement {
</div>
</paper-icon-item>
<paper-listbox slot="dropdown-content" style="min-width: 200px">
<div slot="dropdown-content"vstyle="display: block">
<paper-listbox style="min-width: 200px">
<paper-item>Signed in as:<br> [[user.username]]</paper-item>
<hr>
<paper-item>Roles: [[user.roles]]</paper-item>
Expand All @@ -60,12 +62,15 @@ class UserOptions extends PolymerElement {
<paper-item>Help</paper-item>
<paper-item><a href="[[rootPath]]#/about">About</a></paper-item>
<hr>
<paper-item>
<paper-button on-tap="_logout" icon="exit-to-app" title="Exit">
Sign out
</paper-button>
</paper-item>
</paper-listbox>
</paper-listbox>
<paper-item>
<a href="[[rootPath]]logout" on-click="_logout" style="flex: auto">
Sign out
<iron-icon icon="exit-to-app" style="float: right"></iron-icon>
</a>
</paper-item>
</div>
</paper-menu-button>
</div>
Expand All @@ -82,6 +87,8 @@ class UserOptions extends PolymerElement {
}

_logout() {
this.$.userAjax.url = "/api/logout";
this.$.userAjax._go();
var customEvent = new CustomEvent('logout', {
bubbles: true,
composed: true,
Expand Down

0 comments on commit 30f83f6

Please sign in to comment.