- fixed JS error related to non existent ndg prop;

This commit is contained in:
Vitalii Kiiko
2026-02-16 15:50:07 +01:00
parent a29f88d252
commit abfcb1168e
3 changed files with 22 additions and 22 deletions

View File

@@ -790,10 +790,10 @@ const DomandaEditInstructorManager = () => {
detail: data.message detail: data.message
}); });
} }
if (data.data.ndg) { if (data.data?.ndg) {
setData((data) => ({ setData((data) => ({
...data, ...data,
ndg: data.data.ndg ndg: data.data?.ndg
})); }));
} }
} }
@@ -1002,7 +1002,7 @@ const DomandaEditInstructorManager = () => {
const shouldDisableNewSoccorso = () => { const shouldDisableNewSoccorso = () => {
if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') { if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') {
//return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked; //return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked;
return !data.ndg || !allFilesRated || !atLeastOneChecked; return !data?.ndg || !allFilesRated || !atLeastOneChecked;
} else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') { } else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') {
return !allFilesRated || !atLeastOneChecked; return !allFilesRated || !atLeastOneChecked;
} else { } else {
@@ -1463,7 +1463,7 @@ const DomandaEditInstructorManager = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(o.name)} fileDescr={renderHtmlContent(o.name)}
fileId={o.id} fileId={o.id}
@@ -1503,7 +1503,7 @@ const DomandaEditInstructorManager = () => {
<div>{renderHtmlContent(data.signedDocument.fileName)}</div> <div>{renderHtmlContent(data.signedDocument.fileName)}</div>
<div className="appPageSection__iconActions"> <div className="appPageSection__iconActions">
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(data.signedDocument.fileName)} fileDescr={renderHtmlContent(data.signedDocument.fileName)}
fileId={data.signedDocument.id} fileId={data.signedDocument.id}
@@ -1530,7 +1530,7 @@ const DomandaEditInstructorManager = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="files" name="files"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
: <p>{__('Nessun documento allegato', 'gepafin')}</p>} : <p>{__('Nessun documento allegato', 'gepafin')}</p>}
</div> </div>
@@ -1652,7 +1652,7 @@ const DomandaEditInstructorManager = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(o.name)} fileDescr={renderHtmlContent(o.name)}
fileId={o.id} fileId={o.id}
@@ -1698,7 +1698,7 @@ const DomandaEditInstructorManager = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(data.signedDocument.fileName)} fileDescr={renderHtmlContent(data.signedDocument.fileName)}
fileId={data.signedDocument.id} fileId={data.signedDocument.id}
@@ -1725,7 +1725,7 @@ const DomandaEditInstructorManager = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="files" name="files"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
: <p>{__('Nessun documento allegato', 'gepafin')}</p>} : <p>{__('Nessun documento allegato', 'gepafin')}</p>}
</div> </div>
@@ -1741,7 +1741,7 @@ const DomandaEditInstructorManager = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="amendmentDetails" name="amendmentDetails"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
</div> : null} </div> : null}

View File

@@ -790,10 +790,10 @@ const DomandaEditPreInstructor = () => {
detail: data.message detail: data.message
}); });
} }
if (data.data.ndg) { if (data.data?.ndg) {
setData((data) => ({ setData((data) => ({
...data, ...data,
ndg: data.data.ndg ndg: data.data?.ndg
})); }));
} }
} }
@@ -1002,7 +1002,7 @@ const DomandaEditPreInstructor = () => {
const shouldDisableNewSoccorso = () => { const shouldDisableNewSoccorso = () => {
if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') { if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') {
//return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked; //return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked;
return !data.ndg || !allFilesRated || !atLeastOneChecked; return !data?.ndg || !allFilesRated || !atLeastOneChecked;
} else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') { } else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') {
return !allFilesRated || !atLeastOneChecked; return !allFilesRated || !atLeastOneChecked;
} else { } else {
@@ -1463,7 +1463,7 @@ const DomandaEditPreInstructor = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(o.name)} fileDescr={renderHtmlContent(o.name)}
fileId={o.id} fileId={o.id}
@@ -1503,7 +1503,7 @@ const DomandaEditPreInstructor = () => {
<div>{renderHtmlContent(data.signedDocument.fileName)}</div> <div>{renderHtmlContent(data.signedDocument.fileName)}</div>
<div className="appPageSection__iconActions"> <div className="appPageSection__iconActions">
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(data.signedDocument.fileName)} fileDescr={renderHtmlContent(data.signedDocument.fileName)}
fileId={data.signedDocument.id} fileId={data.signedDocument.id}
@@ -1530,7 +1530,7 @@ const DomandaEditPreInstructor = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="files" name="files"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
: <p>{__('Nessun documento allegato', 'gepafin')}</p>} : <p>{__('Nessun documento allegato', 'gepafin')}</p>}
</div> </div>
@@ -1652,7 +1652,7 @@ const DomandaEditPreInstructor = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(o.name)} fileDescr={renderHtmlContent(o.name)}
fileId={o.id} fileId={o.id}
@@ -1698,7 +1698,7 @@ const DomandaEditPreInstructor = () => {
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
<ArchiveDocument <ArchiveDocument
ndg={data.ndg} ndg={data?.ndg}
applicationId={id} applicationId={id}
fileDescr={renderHtmlContent(data.signedDocument.fileName)} fileDescr={renderHtmlContent(data.signedDocument.fileName)}
fileId={data.signedDocument.id} fileId={data.signedDocument.id}
@@ -1725,7 +1725,7 @@ const DomandaEditPreInstructor = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="files" name="files"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
: <p>{__('Nessun documento allegato', 'gepafin')}</p>} : <p>{__('Nessun documento allegato', 'gepafin')}</p>}
</div> </div>
@@ -1741,7 +1741,7 @@ const DomandaEditPreInstructor = () => {
updateFn={updateEvaluationValue} updateFn={updateEvaluationValue}
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)} shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="amendmentDetails" name="amendmentDetails"
ndg={data.ndg} ndg={data?.ndg}
applicationId={id}/> applicationId={id}/>
</div> : null} </div> : null}

View File

@@ -8,11 +8,11 @@ export class NetworkService {
if (status === 500) { if (status === 500) {
logMsgWithSentry(endpoint, status, resp); logMsgWithSentry(endpoint, status, resp);
} else if (status === 403) { } else if (status === 403) {
storeSet('token', ''); /*storeSet('token', '');
const { pathname } = window.location; const { pathname } = window.location;
if (!['/login', '/registration', '/loginadmin', '/reset-password-admin', '/confidi', '/reset-password'].includes(pathname)) { if (!['/login', '/registration', '/loginadmin', '/reset-password-admin', '/confidi', '/reset-password'].includes(pathname)) {
window.location.replace('/login'); window.location.replace('/login');
} }*/
} }
} }