nicolium: cleanup

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-06 14:11:19 +01:00
parent 73c22ccf3f
commit 032df3cab5

View File

@ -28,26 +28,22 @@ const fetchFrontendConfigurations = () => (dispatch: AppDispatch, getState: () =
/** Conditionally fetches Nicolium config depending on backend features */
const fetchFrontendConfig =
(host: string | null) => (dispatch: AppDispatch, getState: () => RootState) => {
(host: string | null) => async (dispatch: AppDispatch, getState: () => RootState) => {
const features = getState().auth.client.features;
if (features.frontendConfigurations) {
return dispatch(fetchFrontendConfigurations()).then((data) => {
const legacyKey = 'pl_fe';
const key = 'nicolium';
const data = await dispatch(fetchFrontendConfigurations());
const legacyKey = 'pl_fe';
const key = 'nicolium';
const foundData = data[key] || data[legacyKey];
const foundData = data[key] || data[legacyKey];
if (foundData) {
dispatch(importFrontendConfig(foundData, host));
return foundData;
} else {
return dispatch(fetchFrontendConfigJson(host));
}
});
} else {
return dispatch(fetchFrontendConfigJson(host));
if (foundData) {
dispatch(importFrontendConfig(foundData, host));
return foundData;
}
}
return dispatch(fetchFrontendConfigJson(host));
};
/** Tries to remember the config from browser storage before fetching it */