- updated zustand and react libraries;
- added 'put in draft' btn;
This commit is contained in:
@@ -5,7 +5,7 @@ import { wrap } from 'object-path-immutable';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
import { storeGet, storeSet, useStore } from '../../../../store';
|
||||
import { storeGet, storeSet, useStoreValue } from '../../../../store';
|
||||
|
||||
// tools
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
@@ -36,9 +36,9 @@ import { Badge } from 'primereact/badge';
|
||||
const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const companies = useStore().main.companies();
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const chosenCompanyId = useStoreValue('chosenCompanyId');
|
||||
const companies = useStoreValue('companies');
|
||||
const isAsyncRequest = useStoreValue('isAsyncRequest');
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [expandedRows, setExpandedRows] = useState(null);
|
||||
@@ -49,7 +49,7 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
|
||||
|
||||
if (existingCompany && !isAsyncRequest) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||
['companyId', chosenCompanyId],
|
||||
['onlyPreferredCall', showOnlyPreferred]
|
||||
@@ -62,12 +62,12 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
setItems(getFormattedBandiData(data.data));
|
||||
setStatuses(uniq(data.data.map(o => o.status)))
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetCallbacks = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const getFormattedBandiData = (data) => {
|
||||
@@ -124,7 +124,7 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||
};
|
||||
|
||||
const addToFavourites = (id, preferredId) => {
|
||||
const companyId = storeGet.main.chosenCompanyId()
|
||||
const companyId = storeGet('chosenCompanyId')
|
||||
const data = {
|
||||
companyId,
|
||||
callId: id
|
||||
|
||||
@@ -4,15 +4,15 @@ import { Link } from 'react-router-dom';
|
||||
import { head, isEmpty } from 'ramda';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../store';
|
||||
import { useStoreValue } from '../../store';
|
||||
|
||||
// components
|
||||
import AllBandiAccordion from './components/AllBandiAccordion';
|
||||
import ErrorBoundary from '../../components/ErrorBoundary';
|
||||
|
||||
const BandiBeneficiario = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
const companies = useStore().main.companies();
|
||||
const chosenCompanyId = useStoreValue('chosenCompanyId');
|
||||
const companies = useStoreValue('companies');
|
||||
const company = head(companies.filter(o => o.id === chosenCompanyId));
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user