l-min-components 1.7.1493 → 1.7.1495

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.7.1493",
3
+ "version": "1.7.1495",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -188,6 +188,27 @@ 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
+ console.log(urlContainsAccountType, "URLS");
207
+
208
+ if (!urlContainsAccountType) {
209
+ window.location.href = `/${defaultAccountType}`;
210
+ }
211
+ }
191
212
  }
192
213
  }, [getDefaultAccount?.data]);
193
214