salix/print/templates/email/greuge-wrong/greuge-wrong.js

36 lines
946 B
JavaScript
Raw Normal View History

const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
const models = require('vn-loopback/server/server').models;
2023-03-01 09:11:22 +00:00
module.exports = {
name: 'greuge-wrong',
async serverPrefetch() {
this.url = await this.salixUrl();
if (!this.url)
throw new Error('Something went wrong');
},
components: {
'email-body': emailBody.build(),
},
methods: {
async salixUrl() {
const salix = await models.Url.findOne({
where: {
appName: 'salix',
environment: process.env.NODE_ENV || 'dev'
}
});
return salix.url;
2023-03-01 09:11:22 +00:00
},
clientGreugeUrl(clientId) {
return `${this.url}client/${clientId}/greuge/index`
2023-03-01 09:11:22 +00:00
},
},
props: {
tickets: {
type: Array,
2023-03-01 09:11:22 +00:00
required: true
},
},
};