From 374f60da97f07226d4f1c75544fd2fab86bbc25f Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Thu, 10 Oct 2024 15:23:25 +0200 Subject: [PATCH] - removed console log; - added toast when switching companies; --- src/components/TopBarProfileMenu/index.js | 16 +++++++++++++--- src/pages/BandoApplication/index.js | 2 +- src/pages/BandoViewBeneficiario/index.js | 18 ------------------ 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/components/TopBarProfileMenu/index.js b/src/components/TopBarProfileMenu/index.js index fef4193..bbcd140 100644 --- a/src/components/TopBarProfileMenu/index.js +++ b/src/components/TopBarProfileMenu/index.js @@ -1,13 +1,14 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { __ } from '@wordpress/i18n'; import { useNavigate } from 'react-router-dom'; +import { intersection } from 'ramda'; // store import { storeSet, useStore, useTrackedStore } from '../../store'; // components import { Menu } from 'primereact/menu'; -import { intersection } from 'ramda'; +import { Toast } from 'primereact/toast'; const TopBarProfileMenu = ({ menuLeftRef }) => { const navigate = useNavigate(); @@ -26,6 +27,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => { {item.label} ); + const toast = useRef(null); let items = [ { template: (item, options) => { @@ -84,6 +86,13 @@ const TopBarProfileMenu = ({ menuLeftRef }) => { const switchCompany = (id) => { if (chosenCompanyId !== id) { storeSet.main.chosenCompanyId(id); + if (toast.current) { + toast.current.show({ + severity: 'success', + summary: '', + detail: __('L\'azienda รจ stata cambiata') + }); + } } } @@ -93,10 +102,11 @@ const TopBarProfileMenu = ({ menuLeftRef }) => { companyId: o.id, template: renderCompanyItem })); - setCompanyItems(items) + setCompanyItems(items); }, [companies, chosenCompanyId]) return <> + } diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 77b34d4..f433ed8 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -254,7 +254,7 @@ const BandoApplication = () => { acc[cur.fieldId] = cur.fieldValue; return acc; }, {}); - console.log('formDataInitial', formDataInitial) + setFormInitialData(formDataInitial); } } diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index dfe89f5..3e43883 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -137,15 +137,6 @@ const BandoViewBeneficiario = () => { } const errCreateCallback = (data) => { - /*if (bandoMsgs.current && data.message) { - bandoMsgs.current.show([ - { - sticky: true, severity: 'error', summary: '', - detail: data.message, - closable: true - } - ]); - }*/ if (toast.current && data.message) { toast.current.show({ severity: 'error', @@ -163,15 +154,6 @@ const BandoViewBeneficiario = () => { } const errGetBandoCallback = (data) => { - /*if (bandoMsgs.current && data.message) { - bandoMsgs.current.show([ - { - sticky: true, severity: 'error', summary: '', - detail: data.message, - closable: true - } - ]); - }*/ if (toast.current && data.message) { toast.current.show({ severity: 'error',