32 lines
831 B
JavaScript
Executable File
32 lines
831 B
JavaScript
Executable File
const Component = require(`${appPath}/core/component`);
|
|
const db = require(`${appPath}/core/database`);
|
|
const emailHeader = new Component('email-header');
|
|
const emailFooter = new Component('email-footer');
|
|
|
|
module.exports = {
|
|
name: 'buyer-week-waste',
|
|
async serverPrefetch() {
|
|
this.wastes = await this.fetchWastes();
|
|
|
|
if (!this.wastes)
|
|
throw new Error('Something went wrong');
|
|
},
|
|
computed: {
|
|
dated: function() {
|
|
const filters = this.$options.filters;
|
|
|
|
return filters.date(new Date(), '%d-%m-%Y');
|
|
}
|
|
},
|
|
methods: {
|
|
fetchWastes() {
|
|
return db.findOne(`CALL bs.weekWaste()`);
|
|
}
|
|
},
|
|
components: {
|
|
'email-header': emailHeader.build(),
|
|
'email-footer': emailFooter.build()
|
|
},
|
|
props: {}
|
|
};
|