@overmap-ai/core 1.0.27 → 1.0.29-org-switcher-and-bug-fixes.0
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/dist/overmap-core.js
CHANGED
|
@@ -4872,14 +4872,18 @@ class MainService extends BaseApiService {
|
|
|
4872
4872
|
}
|
|
4873
4873
|
}
|
|
4874
4874
|
store.dispatch(setCurrentUser(data.user));
|
|
4875
|
+
store.dispatch(addUsers(data.project_owners));
|
|
4875
4876
|
const organizationsData = data.organizations;
|
|
4876
4877
|
store.dispatch(setOrganizations(organizationsData));
|
|
4878
|
+
const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
|
|
4877
4879
|
const firstOrg = organizationsData[0];
|
|
4878
4880
|
const currProjObj = projects.find((project) => project.id === currentProjectId);
|
|
4879
4881
|
const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
|
|
4880
4882
|
const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
|
|
4881
4883
|
let currentOrgId = null;
|
|
4882
|
-
if (
|
|
4884
|
+
if (activeOrganizationId) {
|
|
4885
|
+
currentOrgId = activeOrganizationId;
|
|
4886
|
+
} else if (userIsInProjectOrg) {
|
|
4883
4887
|
currentOrgId = currProjObj.owner_organization;
|
|
4884
4888
|
} else if (firstOrg) {
|
|
4885
4889
|
currentOrgId = firstOrg.id;
|