- styled asteriks sign;
- fixed issue with validation on registration page; - fixed issue with inputnumber; - fixed issue with editor field;; - added editors for new faq item form; - fixed displaying html as simple text; - fixed saving company data after saving; - added toast for edit bando form; - improved edit forms form; - fixed styles for various elements;
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty, isNil, pathOr } from 'ramda';
|
||||
import { isEmpty, isNil, pathOr, head } from 'ramda';
|
||||
import { klona } from 'klona';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
import { storeSet, useStore, storeGet } from '../../store';
|
||||
|
||||
// components
|
||||
import { Messages } from 'primereact/messages';
|
||||
@@ -18,7 +19,6 @@ import CompanyService from '../../service/company-service';
|
||||
// tools
|
||||
import { isPIVA } from '../../helpers/validators';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import { klona } from 'klona';
|
||||
|
||||
const ProfileCompany = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -67,7 +67,19 @@ const ProfileCompany = () => {
|
||||
|
||||
const updateCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
//setData(getFormattedBandiData(data.data));
|
||||
const company = klona(data.data);
|
||||
const companies = storeGet.main.companies();
|
||||
const existingCompany = head(companies.filter(o => o.id === company.id));
|
||||
let newCompanies = [];
|
||||
|
||||
if (existingCompany) {
|
||||
newCompanies = companies.map(o => o.id === company.id ? company : o)
|
||||
} else {
|
||||
newCompanies = [...companies, company];
|
||||
storeSet.main.chosenCompanyId(company.id);
|
||||
}
|
||||
|
||||
storeSet.main.companies(newCompanies);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -129,7 +141,6 @@ const ProfileCompany = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const chosenCompany = pathOr({}, [0], companies);
|
||||
console.log('chosenCompany', chosenCompany, companies)
|
||||
setFormInitialData(chosenCompany);
|
||||
}, [companies]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user