github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/components/profile-navbar-item.js (about)

     1  // @ts-check
     2  
     3  import Component from '@glimmer/component';
     4  import { inject as service } from '@ember/service';
     5  
     6  export default class ProfileNavbarItemComponent extends Component {
     7    @service token;
     8    @service router;
     9    @service store;
    10  
    11    profileOptions = [
    12      {
    13        label: 'Authorization',
    14        key: 'authorization',
    15        action: () => {
    16          this.router.transitionTo('settings.tokens');
    17        },
    18      },
    19      {
    20        label: 'Sign Out',
    21        key: 'sign-out',
    22        action: () => {
    23          this.token.setProperties({
    24            secret: undefined,
    25          });
    26  
    27          // Clear out all data to ensure only data the anonymous token is privileged to see is shown
    28          this.store.unloadAll();
    29          this.token.reset();
    30          this.router.transitionTo('jobs.index');
    31        },
    32      },
    33    ];
    34  
    35    profileSelection = this.profileOptions[0];
    36  }