@campxdev/shared 1.11.7-0.alpha.36 → 1.11.7-0.alpha.37
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 +1 -1
- package/src/hooks/useAuth.ts +16 -8
package/package.json
CHANGED
package/src/hooks/useAuth.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AxiosError } from 'axios'
|
|
2
|
-
import Cookies from 'js-cookie'
|
|
3
2
|
import { useEffect, useState } from 'react'
|
|
4
3
|
import { toast } from 'react-toastify'
|
|
5
4
|
import axios from '../config/axios'
|
|
@@ -193,14 +192,23 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
193
192
|
window.location.hostname.split('.').includes('setup') && isAdmin
|
|
194
193
|
const isMasterSlave = res.data?.institutionType === 'MASTER_CHILD'
|
|
195
194
|
|
|
196
|
-
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
197
196
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
197
|
+
if (isDevelopment == false && isStaging == false && !isSetup) {
|
|
198
|
+
if (
|
|
199
|
+
!res.data.applications.includes(ApplicationObj[originSubdomain])
|
|
200
|
+
) {
|
|
201
|
+
window.location.replace(
|
|
202
|
+
`https://www.id.campx.in/apps?redirect_to=${url}`,
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (res.data?.institutions) {
|
|
208
|
+
handleInstitutions(res.data?.institutions)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
setData(res.data)
|
|
204
212
|
UserStore.update((s) => {
|
|
205
213
|
s.username = res.data?.user?.username
|
|
206
214
|
s.user = res.data?.user
|