- fixed issue of making calls with empty company id or it equal to 0;

This commit is contained in:
Vitalii Kiiko
2024-11-14 14:40:51 +01:00
parent b08e2d46c0
commit cf5f04d6c2
5 changed files with 35 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import { is, uniq } from 'ramda';
import { is, isEmpty, uniq } from 'ramda';
import { Link } from 'react-router-dom';
// store
@@ -36,11 +36,13 @@ const BeneficiarioDomandeTable = () => {
const [statuses, setStatuses] = useState([]);
useEffect(() => {
setLocalAsyncRequest(true);
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
['companyId', chosenCompanyId],
['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION']]
])
if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) {
setLocalAsyncRequest(true);
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
['companyId', chosenCompanyId],
['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION']]
]);
}
}, [chosenCompanyId]);
const getApplCallback = (data) => {