@campxdev/shared 1.11.7-0.alpha.38 → 1.11.7-0.alpha.39

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": "@campxdev/shared",
3
- "version": "1.11.7-0.alpha.38",
3
+ "version": "1.11.7-0.alpha.39",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -3,7 +3,6 @@ import { useEffect, useState } from 'react'
3
3
  import { toast } from 'react-toastify'
4
4
  import axios from '../config/axios'
5
5
  import { isDevelopment } from '../constants'
6
- import { urlTenantKey } from '../contexts/Providers'
7
6
  import { openRootModal } from '../contexts/RootModal'
8
7
  import { AssetsStore, PermissionsStore, UserStore } from '../shared-state'
9
8
  import { InstitutionsStore } from '../shared-state/InstitutionsStore'
@@ -78,7 +77,6 @@ const getInstitutionKey = () => {
78
77
  }
79
78
 
80
79
  function handleInstitutions(institutions) {
81
- const insititutionKey = getInstitutionKey()
82
80
  if (institutions?.length === 0) {
83
81
  openRootModal({
84
82
  key: 'institutions-not-assigned',
@@ -87,51 +85,12 @@ function handleInstitutions(institutions) {
87
85
  onClose: () => {},
88
86
  },
89
87
  })
90
- }
91
- if (institutions?.length === 1) {
92
- if (!insititutionKey) {
93
- window.location.replace(
94
- `${window.location.origin}/${urlTenantKey}/${institutions[0]?.code}`,
95
- )
96
- }
97
- if (insititutionKey !== institutions[0]?.code) {
98
- window.location.replace(
99
- `${window.location.origin}/${urlTenantKey}/${institutions[0]?.code}`,
100
- )
101
- }
88
+ } else {
102
89
  InstitutionsStore.update((s) => {
103
90
  s.current = institutions[0]
104
91
  s.institutions = institutions
105
92
  })
106
93
  }
107
- if (institutions?.length > 1) {
108
- if (!insititutionKey) {
109
- openRootModal({
110
- key: 'institutions',
111
- dialogProps: {
112
- disableEscapeKeyDown: true,
113
- onClose: () => {},
114
- maxWidth: 'md',
115
- },
116
- })
117
- }
118
- if (
119
- insititutionKey &&
120
- !institutions?.find((item) => item.code === insititutionKey)
121
- ) {
122
- openRootModal({
123
- key: 'institutions',
124
- dialogProps: {
125
- disableEscapeKeyDown: true,
126
- onClose: () => {},
127
- },
128
- })
129
- }
130
- InstitutionsStore.update((s) => {
131
- s.institutions = institutions
132
- s.current = institutions.find((item) => item.code === insititutionKey)
133
- })
134
- }
135
94
  }
136
95
 
137
96
  const loginErrorHandler = ({