Skip to content

Instantly share code, notes, and snippets.

@FWSimon
Created May 21, 2016 15:48
Show Gist options
  • Save FWSimon/46db1fcbbb7a177a8be44e20dc44c292 to your computer and use it in GitHub Desktop.
Save FWSimon/46db1fcbbb7a177a8be44e20dc44c292 to your computer and use it in GitHub Desktop.
methods: {
/**
* Fetch all invoices for the user
*/
fetchInvoices() {
this.$http({url: '/invoices/fetch', method: 'GET'}).then(function (response) {
console.log('trigged');
//Set the data to the view.
this.$set('invoices', response.data);
}, function (response) {
//TODO: Show a good error message.
console.log('response:');
console.log(response);
});
},
/**
* Send invoice to client
*/
sendInvoice() {
this.activateFirstTab();
Spark.post('/invoices/', this.createForm)
.then(() => {
this.createForm.previewInvoice = false; // To let backend know.
this.previewInvoice = false; // To show the preview page.
this.createForm = new SparkForm(clientCreateForm());
this.fetchInvoices();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment