From 2afd7a2362c2f2314f8e955107fe75858c81493e Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 12 Feb 2025 12:33:49 +0100 Subject: [PATCH] - enabled creation of appl for the same user/company after one being rejected; --- src/pages/BandoViewBeneficiario/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index f6bea38..ad984cf 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -1,7 +1,7 @@ import React, { useState, useEffect, useRef } from 'react'; import { __ } from '@wordpress/i18n'; import { useNavigate, useParams } from 'react-router-dom'; -import { is, isEmpty, isNil } from 'ramda'; +import { head, is, isEmpty, isNil } from 'ramda'; import 'quill/dist/quill.core.css'; // store @@ -244,7 +244,10 @@ const BandoViewBeneficiario = () => { const getApplCallback = (data) => { if (data.status === 'SUCCESS') { if (data.data.length) { - setApplicationObj(data.data[0]); + const nonRejectedAppl = head(data.data.filter(o => !['REJECTED'].includes(o.status))); + if (nonRejectedAppl) { + setApplicationObj(nonRejectedAppl); + } } } storeSet.main.unsetAsyncRequest();