open-vault/ui/app/components/token-expire-warning.js

32 lines
648 B
JavaScript
Raw Normal View History

import { inject as service } from '@ember/service';
import Component from '@ember/component';
2018-04-03 14:16:57 +00:00
export default Component.extend({
auth: service(),
router: service(),
classNames: 'token-expire-warning',
2018-04-03 14:16:57 +00:00
transitionToRoute: function() {
this.get('router').transitionTo(...arguments);
2018-04-03 14:16:57 +00:00
},
isDismissed: false,
actions: {
reauthenticate() {
this.get('auth').deleteCurrentToken();
this.transitionToRoute('vault.cluster');
},
renewToken() {
const auth = this.get('auth');
auth.renew();
auth.setLastFetch(Date.now());
},
dismiss() {
this.set('isDismissed', true);
},
},
});