diff --git a/src/components/SaveButton.tsx b/src/components/SaveButton.tsx index a83ad89..0323ffe 100644 --- a/src/components/SaveButton.tsx +++ b/src/components/SaveButton.tsx @@ -20,16 +20,30 @@ export default function SaveButton() { className="saveButton" onClick={() => { let stateOk = true; - Object.keys(data.oidcRPMetaDataOptions).forEach((app) => { - if (!ruleOIDC(data.oidcRPMetaDataOptions[app])) { - stateOk = false; - } - }); - Object.keys(data.samlSPMetaDataXML).forEach((app) => { - if (!ruleSAML(data.samlSPMetaDataXML[app])) { - stateOk = false; - } - }); + if (data.oidcRPMetaDataOptions) { + Object.keys(data.oidcRPMetaDataOptions).forEach((app) => { + if ( + !ruleOIDC( + data.oidcRPMetaDataOptions + ? data.oidcRPMetaDataOptions[app] + : {} + ) + ) { + stateOk = false; + } + }); + } + if (data.samlSPMetaDataXML) { + Object.keys(data.samlSPMetaDataXML).forEach((app) => { + if ( + !ruleSAML( + data.samlSPMetaDataXML ? data.samlSPMetaDataXML[app] : {} + ) + ) { + stateOk = false; + } + }); + } if (stateOk) { dispatch(saveConfigCall()); setOpenSavingPopup(true); diff --git a/src/components/applicationsComponents/CasApp.tsx b/src/components/applicationsComponents/CasApp.tsx index 4361408..6442430 100644 --- a/src/components/applicationsComponents/CasApp.tsx +++ b/src/components/applicationsComponents/CasApp.tsx @@ -83,6 +83,7 @@ export function CasApp({ name }: { name: string }) { name, vars, "exportedVars", + dispatch, delCASexportedVars, updateCASexportedVars )} @@ -118,6 +119,7 @@ export function CasApp({ name }: { name: string }) { name, casAppMetaDataMacros, "macros", + dispatch, delCASAppMetaDataMacros, updateCASAppMetaDataMacros )} diff --git a/src/components/applicationsComponents/NativeApp.tsx b/src/components/applicationsComponents/NativeApp.tsx index 15490aa..089df15 100644 --- a/src/components/applicationsComponents/NativeApp.tsx +++ b/src/components/applicationsComponents/NativeApp.tsx @@ -375,20 +375,27 @@ function NativPost( } export function NativeApp({ name }: { name: string }) { - const locationRules = useAppSelector( - (state) => state.config.data.config.locationRules[name] - ); + const locationR = useAppSelector((state) => { + if (state.config.data.config.locationRules) { + return state.config.data.config.locationRules[name]; + } + }); + const locationRules = locationR ? locationR : {}; const exportedHeaders = useAppSelector((state) => { - return state.config.data.config.exportedHeaders - ? state.config.data.config.exportedHeaders[name] - : {}; + if (state.config.data.config.exportedHeaders) { + return state.config.data.config.exportedHeaders[name]; + } + }); + const post = useAppSelector((state) => { + if (state.config.data.config.post) { + return state.config.data.config.post[name]; + } + }); + const options = useAppSelector((state) => { + if (state.config.data.config.vhostOptions) { + return state.config.data.config.vhostOptions[name]; + } }); - const post = useAppSelector((state) => - state.config.data.config.post ? state.config.data.config.post[name] : {} - ); - const options = useAppSelector( - (state) => state.config.data.config.vhostOptions[name] - ); const [optionSelected, setOptionSelected] = useState("basic"); const dispatch = useAppDispatch(); return ( @@ -474,7 +481,7 @@ export function NativeApp({ name }: { name: string }) { { dispatch( updateVhostOptions({ @@ -553,8 +560,9 @@ export function NativeApp({ name }: { name: string }) { {TableVars( name, - exportedHeaders, + exportedHeaders ? exportedHeaders : {}, "exportedHeaders", + dispatch, delVhostHeader, updateVhostHeaders )} @@ -589,7 +597,7 @@ export function NativeApp({ name }: { name: string }) { - {NativPost(name, post)} + {NativPost(name, post ? post : {})}