const Component = require(`${appPath}/core/component`); const reportHeader = new Component('report-header'); const reportFooter = new Component('report-footer'); module.exports = { name: 'receipt', async serverPrefetch() { this.client = await this.fetchClient(this.receiptId); this.receipt = await this.fetchReceipt(this.receiptId); if (!this.receipt) throw new Error('Something went wrong'); }, methods: { fetchClient(receiptId) { return this.findOneFromDef('client', [receiptId]); }, fetchReceipt(receiptId) { return this.findOneFromDef('receipt', [receiptId]); } }, components: { 'report-header': reportHeader.build(), 'report-footer': reportFooter.build() }, props: { receiptId: { required: true } } };