@campxdev/shared 1.10.89 → 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,11 +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
172
|
const isSetup = window.location.hostname.split('.').includes('setup')
|
|
173
|
-
console.log('isSetup in error fallback', isSetup)
|
|
174
173
|
const sessionCookie = Cookies.get('campx_session_key')
|
|
175
174
|
|
|
176
175
|
const appinit = async () => {
|
|
@@ -196,7 +195,7 @@ export function UnAuth({ resetBoundary }) {
|
|
|
196
195
|
})
|
|
197
196
|
}
|
|
198
197
|
function LoginPage() {
|
|
199
|
-
if (
|
|
198
|
+
if (isDevelopment) {
|
|
200
199
|
if (!sessionCookie) {
|
|
201
200
|
openRootModal({
|
|
202
201
|
key: 'login',
|
|
@@ -214,10 +213,10 @@ export function UnAuth({ resetBoundary }) {
|
|
|
214
213
|
}
|
|
215
214
|
|
|
216
215
|
useEffect(() => {
|
|
217
|
-
if (!
|
|
216
|
+
if (!isDevelopment && !isSetup) {
|
|
218
217
|
window.location.replace(`https://www.id.campx.in/?redirect_to=${url}`)
|
|
219
218
|
}
|
|
220
|
-
}, [
|
|
219
|
+
}, [isDevelopment])
|
|
221
220
|
|
|
222
221
|
return (
|
|
223
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 (
|