osb/spark/resources/assets/js/settings/api.js

53 lines
1005 B
JavaScript
Raw Normal View History

2017-11-03 05:26:07 +00:00
module.exports = {
/**
* The component's data.
*/
data() {
return {
tokens: [],
availableAbilities: []
};
},
/**
* Prepare the component.
*/
mounted() {
this.getTokens();
this.getAvailableAbilities();
},
/**
* The component has been created by Vue.
*/
created() {
var self = this;
this.$on('updateTokens', function(){
self.getTokens();
});
},
methods: {
/**
* Get the current API tokens for the user.
*/
getTokens() {
axios.get('/settings/api/tokens')
.then(response => this.tokens = response.data);
},
/**
* Get all of the available token abilities.
*/
getAvailableAbilities() {
axios.get('/settings/api/token/abilities')
.then(response => this.availableAbilities = response.data);
}
}
};