From c3d08c94d1f52bbfeb5f40b488bec36e65d6fe5a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 3 Jun 2024 12:24:06 +0200 Subject: [PATCH] feat: 5926: Refresh button --- src/pages/Worker/Card/WorkerPda.vue | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pages/Worker/Card/WorkerPda.vue b/src/pages/Worker/Card/WorkerPda.vue index 3d7380fc2..32adc91a5 100644 --- a/src/pages/Worker/Card/WorkerPda.vue +++ b/src/pages/Worker/Card/WorkerPda.vue @@ -65,14 +65,16 @@ const handleSendToTablet = async (row) => { console.error('Error removing department'); } }; +function checkFileFocuware({ deviceProductionFk }) { + return axios.post(`Docuwares/${deviceProductionFk}/checkFile`, { + fileCabinet: 'hr', + signed: true, + }); +} const handleRefreshDocuware = async (row) => { try { if (isProduction()) { - const { deviceProductionFk } = row; - await axios.post(`Docuwares/upload`, { - fileCabinet: 'hr', - ids: [deviceProductionFk], - }); + await checkFileFocuware(row); } notify(t('PDA Signed'), 'positive'); row.isSigned = true; @@ -96,12 +98,7 @@ const handleDownloadDocuware = async (row) => { }; async function fetchDocuware(deviceProductions) { - let promises = deviceProductions.map(({ deviceProductionFk }) => - axios.post(`Docuwares/${deviceProductionFk}/checkFile`, { - fileCabinet: 'hr', - signed: true, - }) - ); + let promises = deviceProductions.map((device) => checkFileFocuware(device)); promises = await Promise.all(promises); promises.forEach((promise) => { const id = +promise.config.url.match(/\d+/)[0];