This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
site-base/spark/resources/assets/js/settings/invoices.js

48 lines
717 B
JavaScript
Raw Normal View History

2017-11-03 05:26:07 +00:00
module.exports = {
props: ['user', 'team', 'billableType'],
/**
* The component's data.
*/
data() {
return {
invoices: []
};
},
/**
* Prepare the component.
*/
mounted() {
this.getInvoices();
},
methods: {
/**
* Get the user's billing invoices
*/
getInvoices() {
axios.get(this.urlForInvoices)
.then(response => {
this.invoices = _.filter(response.data, invoice => {
return invoice.total != '$0.00';
});
});
}
},
computed: {
/**
* Get the URL for retrieving the invoices.
*/
urlForInvoices() {
return this.billingUser
? '/settings/invoices'
: `/settings/${Spark.pluralTeamString}/${this.team.id}/invoices`;
}
}
};