- fixed fileupload;

This commit is contained in:
Vitalii Kiiko
2024-10-10 14:42:19 +02:00
parent d9e03efa6c
commit 156aac3d20
5 changed files with 132 additions and 87 deletions

View File

@@ -19,6 +19,7 @@ import { AccordionTab } from 'primereact/accordion';
import { Button } from 'primereact/button';
import { Messages } from 'primereact/messages';
import { Message } from 'primereact/message';
import { Toast } from 'primereact/toast';
// api
import BandoService from '../../service/bando-service';
@@ -35,6 +36,7 @@ const BandoViewBeneficiario = () => {
const [newQuestion, setNewQuestion] = useState('');
const [applicationObj, setApplicationObj] = useState(true);
const bandoMsgs = useRef(null);
const toast = useRef(null);
const scaricaBando = () => {
@@ -66,6 +68,13 @@ const BandoViewBeneficiario = () => {
}
const errCreateApplCallback = (data) => {
if (toast.current) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
if (bandoMsgs.current && data.message) {
bandoMsgs.current.show([
{
@@ -103,7 +112,7 @@ const BandoViewBeneficiario = () => {
const createCallBack = (data) => {
if (data.status === 'SUCCESS') {
setNewQuestion('');
if (bandoMsgs.current && data.message) {
/*if (bandoMsgs.current && data.message) {
bandoMsgs.current.show([
{
sticky: true, severity: 'success', summary: '',
@@ -115,13 +124,20 @@ const BandoViewBeneficiario = () => {
setTimeout(() => {
bandoMsgs.current.clear();
}, 5000);
}*/
if (toast.current) {
toast.current.show({
severity: 'success',
summary: '',
detail: data.message
});
}
}
storeSet.main.unsetAsyncRequest();
}
const errCreateCallback = (data) => {
if (bandoMsgs.current && data.message) {
/*if (bandoMsgs.current && data.message) {
bandoMsgs.current.show([
{
sticky: true, severity: 'error', summary: '',
@@ -129,6 +145,13 @@ const BandoViewBeneficiario = () => {
closable: true
}
]);
}*/
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
storeSet.main.unsetAsyncRequest();
}
@@ -140,7 +163,7 @@ const BandoViewBeneficiario = () => {
}
const errGetBandoCallback = (data) => {
if (bandoMsgs.current && data.message) {
/*if (bandoMsgs.current && data.message) {
bandoMsgs.current.show([
{
sticky: true, severity: 'error', summary: '',
@@ -148,6 +171,13 @@ const BandoViewBeneficiario = () => {
closable: true
}
]);
}*/
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
set404FromErrorResponse(data);
}
@@ -215,6 +245,7 @@ const BandoViewBeneficiario = () => {
<div className="appPage__spacer"></div>
<Messages ref={bandoMsgs}/>
<Toast ref={toast}/>
{!isAsyncRequest && !isEmpty(data)
? <div className="appPage__content">