refactor: el UserError se lanza en back
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c77999871e
commit
ec81b12239
|
@ -1,5 +1,6 @@
|
|||
const JSZip = require('jszip');
|
||||
const fs = require('fs-extra');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('downloadZip', {
|
||||
|
@ -34,7 +35,7 @@ module.exports = Self => {
|
|||
let totalSize = 0;
|
||||
const zipConfig = await models.ZipConfig.findOne();
|
||||
for (let id of ids) {
|
||||
if (zipConfig && totalSize > zipConfig.maxSize) return false;
|
||||
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
|
||||
const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions);
|
||||
const fileName = extractFileName(invoiceOutPdf[2]);
|
||||
const body = invoiceOutPdf[0];
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
export default class Controller extends Section {
|
||||
get checked() {
|
||||
|
@ -35,7 +34,6 @@ export default class Controller extends Section {
|
|||
};
|
||||
this.$http.post(`InvoiceOuts/downloadZip`, params)
|
||||
.then(res => {
|
||||
if (res.data == false) throw new UserError('Files are too large');
|
||||
location.href = 'data:application/zip;base64,' + res.data;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue