Created
May 21, 2016 15:48
-
-
Save FWSimon/46db1fcbbb7a177a8be44e20dc44c292 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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