Skip to content

Commit

Permalink
Merge pull request #143 from CybercentreCanada/hotfix/user_menu
Browse files Browse the repository at this point in the history
Set Apps on configuration changes
  • Loading branch information
cccs-sgaron authored Sep 24, 2021
2 parents e353dec + fcb5c75 commit 4021c60
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MyApp = () => {

const provider = getProvider();
const { t } = useTranslation();
const { setUser, setConfiguration, user } = useALContext();
const { setUser, setConfiguration, user, configuration } = useALContext();
const { setReady, setApps } = useAppLayout();
const { showErrorMessage } = useMySnackbar();

Expand All @@ -49,6 +49,12 @@ const MyApp = () => {
}
};

useEffect(() => {
if (configuration && configuration.ui.apps) {
setApps(configuration.ui.apps);
}
}, [configuration, setApps]);

useEffect(() => {
if (user || provider) {
return;
Expand Down Expand Up @@ -88,11 +94,6 @@ const MyApp = () => {
// Set the current user
setUser(api_data.api_response);

//Set the app list?
if (api_data.api_response.configuration.ui.apps) {
setApps(api_data.api_response.configuration.ui.apps);
}

// Mark the interface ready
setReady(true);

Expand Down

0 comments on commit 4021c60

Please sign in to comment.