37 lines
960 B
JavaScript
Executable File
37 lines
960 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) {
|
|
console.log(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');
|
|
},
|
|
},
|
|
};
|