@campxdev/shared 1.10.88 → 1.10.90
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
|
@@ -166,9 +166,10 @@ export function UnAuth({ resetBoundary }) {
|
|
|
166
166
|
|
|
167
167
|
const url = window.location.origin
|
|
168
168
|
const origin = window?.location?.origin?.split('.')
|
|
169
|
-
const
|
|
169
|
+
const isDevelopment =
|
|
170
170
|
process.env.NODE_ENV === 'development' ||
|
|
171
171
|
origin?.slice(-2).join('.') === 'campx.dev'
|
|
172
|
+
const isSetup = window.location.hostname.split('.').includes('setup')
|
|
172
173
|
const sessionCookie = Cookies.get('campx_session_key')
|
|
173
174
|
|
|
174
175
|
const appinit = async () => {
|
|
@@ -194,7 +195,7 @@ export function UnAuth({ resetBoundary }) {
|
|
|
194
195
|
})
|
|
195
196
|
}
|
|
196
197
|
function LoginPage() {
|
|
197
|
-
if (
|
|
198
|
+
if (isDevelopment) {
|
|
198
199
|
if (!sessionCookie) {
|
|
199
200
|
openRootModal({
|
|
200
201
|
key: 'login',
|
|
@@ -212,10 +213,10 @@ export function UnAuth({ resetBoundary }) {
|
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
useEffect(() => {
|
|
215
|
-
if (!
|
|
216
|
+
if (!isDevelopment && !isSetup) {
|
|
216
217
|
window.location.replace(`https://www.id.campx.in/?redirect_to=${url}`)
|
|
217
218
|
}
|
|
218
|
-
}, [
|
|
219
|
+
}, [isDevelopment])
|
|
219
220
|
|
|
220
221
|
return (
|
|
221
222
|
<>
|
package/src/hooks/useAuth.ts
CHANGED
|
@@ -52,14 +52,6 @@ const checkIsAdmin = (user) => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
|
-
console.log(
|
|
57
|
-
'Current App ->',
|
|
58
|
-
ApplicationObj[subDomain],
|
|
59
|
-
'; subdomain env ->',
|
|
60
|
-
subDomain,
|
|
61
|
-
)
|
|
62
|
-
|
|
63
55
|
const profiles: any[] = user?.profiles?.filter(
|
|
64
56
|
(item) => item.application == ApplicationObj[subDomain],
|
|
65
57
|
)
|
|
@@ -152,8 +144,9 @@ const loginErrorHandler = ({
|
|
|
152
144
|
setLoading && setLoading(false)
|
|
153
145
|
const origin = window.location.origin
|
|
154
146
|
const isStaging = origin.split('campx')[1] === '.dev'
|
|
147
|
+
const isSetup = window.location.hostname.split('.').includes('setup')
|
|
155
148
|
|
|
156
|
-
if (isDevelopment || isStaging) {
|
|
149
|
+
if (isDevelopment || isStaging || isSetup) {
|
|
157
150
|
openRootModal({
|
|
158
151
|
key: 'login',
|
|
159
152
|
contentData: {
|
|
@@ -198,8 +191,6 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
198
191
|
const isMasterSlave = res.data?.institutionType === 'MASTER_CHILD'
|
|
199
192
|
|
|
200
193
|
// eslint-disable-next-line no-console
|
|
201
|
-
console.log('Is Admin -> ', isAdmin)
|
|
202
|
-
console.log('Is Setup -> ', isAdmin && isSetup)
|
|
203
194
|
|
|
204
195
|
if (isDevelopment == false && isStaging == false && !isSetup) {
|
|
205
196
|
if (
|