l-min-components 1.7.1492 → 1.7.1494
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -188,6 +188,26 @@ const AppMainLayout = ({ children }) => {
|
|
|
188
188
|
handleSetDefaultAccount(getDefaultAccount?.data?.id);
|
|
189
189
|
|
|
190
190
|
setSelectedAccount(getDefaultAccount?.data);
|
|
191
|
+
|
|
192
|
+
// when we get the default account type (getDefaultAccount?.data?.type),
|
|
193
|
+
// if url is not containing settings, notifications or help,
|
|
194
|
+
// check if url contains default account type and if it doesn't
|
|
195
|
+
// navigate the user using href to /default account type in lower case
|
|
196
|
+
const currentUrl = window.location.pathname;
|
|
197
|
+
const defaultAccountType = getDefaultAccount?.data?.type?.toLowerCase();
|
|
198
|
+
|
|
199
|
+
const excludedPaths = ["settings", "notifications", "help"];
|
|
200
|
+
const shouldSkipNavigation = excludedPaths.some((path) =>
|
|
201
|
+
currentUrl.includes(path)
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (!shouldSkipNavigation && defaultAccountType) {
|
|
205
|
+
const urlContainsAccountType = currentUrl.includes(defaultAccountType);
|
|
206
|
+
|
|
207
|
+
if (!urlContainsAccountType) {
|
|
208
|
+
window.location.href = `/${defaultAccountType}`;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
191
211
|
}
|
|
192
212
|
}, [getDefaultAccount?.data]);
|
|
193
213
|
|