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