@campxdev/shared 1.9.4 → 1.10.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/package.json +1 -1
- package/src/hooks/useAuth.ts +8 -4
package/package.json
CHANGED
package/src/hooks/useAuth.ts
CHANGED
|
@@ -188,8 +188,15 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
188
188
|
const originSubdomain =
|
|
189
189
|
window.location.host.split('.')?.slice(-3)[0] ?? 'ums'
|
|
190
190
|
const isStaging = origin.split('campx')[1] === '.dev'
|
|
191
|
+
const isAdmin = checkIsAdmin(res.data.user)
|
|
192
|
+
const isSetup =
|
|
193
|
+
window.location.hostname.split('.').includes('setup') && isAdmin
|
|
194
|
+
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
196
|
+
console.log('Is Admin -> ', isAdmin)
|
|
197
|
+
console.log('Is Setup -> ', isAdmin && isSetup)
|
|
191
198
|
|
|
192
|
-
if (isDevelopment == false && isStaging == false) {
|
|
199
|
+
if (isDevelopment == false && isStaging == false && !isSetup) {
|
|
193
200
|
if (
|
|
194
201
|
!res.data.applications.includes(ApplicationObj[originSubdomain])
|
|
195
202
|
) {
|
|
@@ -209,9 +216,6 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
209
216
|
s.user = res.data?.user
|
|
210
217
|
s.roles = res.data?.roles
|
|
211
218
|
})
|
|
212
|
-
const isAdmin = checkIsAdmin(res.data.user)
|
|
213
|
-
// eslint-disable-next-line no-console
|
|
214
|
-
console.log('Is Admin -> ', isAdmin)
|
|
215
219
|
|
|
216
220
|
PermissionsStore.update((s) => {
|
|
217
221
|
s.permissions = {
|