salix/print/report/delivery-note/index.js

36 lines
931 B
JavaScript
Executable File

const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'delivery-note',
async asyncData(ctx, params) {
const promises = [];
const dataIndex = promises.push(this.methods.fetchData()) - 1;
const itemsIndex = promises.push(this.methods.fetchItems()) - 1;
return Promise.all(promises).then(result => {
const [[data]] = result[dataIndex];
const [[items]] = result[itemsIndex];
return {
id1: data.id,
id2: items.id,
};
});
},
data() {
return {
id: null,
};
},
methods: {
fetchData() {
return database.pool.query('SELECT 1 AS id');
},
fetchItems() {
return database.pool.query('SELECT 2 AS id');
},
},
};