From 6dcfc340566175e313a52f7d91f593fbf67c9763 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 27 Feb 2020 13:33:40 +0100 Subject: [PATCH] Fix - Find duplicated client --- modules/client/front/fiscal-data/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 98773de75..b2602f7a4 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -24,14 +24,15 @@ export default class Controller extends Component { const filter = encodeURIComponent(JSON.stringify(filterObj)); const query = `Clients/findOne?filter=${filter}`; this.$http.get(query).then(res => { - if (res.data.id) { - const params = {clientId: res.data.id}; - const question = $t('Found a client with this phone or email', params, null, null, 'sanitizeParameters'); + const params = {clientId: res.data.id}; + const question = $t('Found a client with this phone or email', params, null, null, 'sanitizeParameters'); - this.client.despiteOfClient = params.clientId; - this.$.confirmDuplicatedClient.question = question; - this.$.confirmDuplicatedClient.show(); - } + this.client.despiteOfClient = params.clientId; + this.$.confirmDuplicatedClient.question = question; + this.$.confirmDuplicatedClient.show(); + }).catch(error => { + if (error.status == 404) + this.save(); }); }