@campxdev/shared 1.11.7-0.alpha.37 → 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 +14 -14
- package/src/config/axios.ts +2 -2
- package/src/hooks/useAuth.ts +1 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/shared",
|
|
3
|
-
"version": "1.11.7-0.alpha.
|
|
3
|
+
"version": "1.11.7-0.alpha.39",
|
|
4
4
|
"main": "./exports.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
@@ -31,34 +31,33 @@
|
|
|
31
31
|
"@emotion/react": "^11.11.1",
|
|
32
32
|
"@emotion/styled": "^11.11.0",
|
|
33
33
|
"@hookform/resolvers": "^2.9.10",
|
|
34
|
-
"@
|
|
34
|
+
"@mongodb-js/charts-embed-dom": "3.2.1",
|
|
35
|
+
"@mui/icons-material": "^5.15.20",
|
|
35
36
|
"@mui/lab": "^5.0.0-alpha.146",
|
|
36
|
-
"@mui/material": "^5.15.
|
|
37
|
+
"@mui/material": "^5.15.20",
|
|
37
38
|
"@mui/x-date-pickers": "^6.16.0",
|
|
38
|
-
"axios": "^
|
|
39
|
+
"axios": "^1.7.2",
|
|
39
40
|
"date-fns": "^2.28.0",
|
|
40
41
|
"date-fns-tz": "^2.0.0",
|
|
41
42
|
"device-detector-js": "^3.0.3",
|
|
42
43
|
"fuse.js": "^6.6.2",
|
|
43
|
-
"js-cookie": "^3.0.
|
|
44
|
+
"js-cookie": "^3.0.5",
|
|
44
45
|
"moment": "^2.29.4",
|
|
45
46
|
"pullstate": "^1.24.0",
|
|
46
|
-
"react": "^18.
|
|
47
|
+
"react": "^18.3.1",
|
|
47
48
|
"react-arrows": "^1.2.0",
|
|
48
|
-
"react-dom": "^18.
|
|
49
|
+
"react-dom": "^18.3.1",
|
|
49
50
|
"react-error-boundary": "^3.1.4",
|
|
50
51
|
"react-flatpickr": "^3.10.13",
|
|
51
52
|
"react-helmet": "^6.1.0",
|
|
52
53
|
"react-hook-form": "^7.40.0",
|
|
53
54
|
"react-joyride": "^2.5.5",
|
|
54
|
-
"react-query": "^3.39.
|
|
55
|
-
"react-router-dom": "^6.
|
|
55
|
+
"react-query": "^3.39.3",
|
|
56
|
+
"react-router-dom": "^6.23.1",
|
|
56
57
|
"react-table": "^7.8.0",
|
|
57
58
|
"react-toastify": "^9.0.1",
|
|
58
59
|
"styled-components": "^5.3.5",
|
|
59
|
-
"@mongodb-js/charts-embed-dom": "3.2.1",
|
|
60
60
|
"swiper": "^8.1.5",
|
|
61
|
-
"typescript": "^5.2.2",
|
|
62
61
|
"use-immer": "^0.8.1",
|
|
63
62
|
"yup": "^0.32.11"
|
|
64
63
|
},
|
|
@@ -73,9 +72,9 @@
|
|
|
73
72
|
"@storybook/preset-create-react-app": "^4.0.0",
|
|
74
73
|
"@storybook/react": "^6.5.14",
|
|
75
74
|
"@storybook/testing-library": "^0.0.13",
|
|
76
|
-
"@types/js-cookie": "^3.0.
|
|
75
|
+
"@types/js-cookie": "^3.0.6",
|
|
77
76
|
"@types/node": "^18.11.8",
|
|
78
|
-
"@types/react": "^18.
|
|
77
|
+
"@types/react": "^18.3.3",
|
|
79
78
|
"@types/react-flatpickr": "^3.8.8",
|
|
80
79
|
"@types/react-helmet": "^6.1.6",
|
|
81
80
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
@@ -89,7 +88,8 @@
|
|
|
89
88
|
"eslint-plugin-storybook": "^0.6.8",
|
|
90
89
|
"prettier": "^2.5.0",
|
|
91
90
|
"react-scripts": "^5.0.1",
|
|
92
|
-
"storybook-addon-react-router-v6": "^0.2.1"
|
|
91
|
+
"storybook-addon-react-router-v6": "^0.2.1",
|
|
92
|
+
"typescript": "^5.5.2"
|
|
93
93
|
},
|
|
94
94
|
"resolutions": {
|
|
95
95
|
"react-dev-utils/fork-ts-checker-webpack-plugin": "^6.5.3",
|
package/src/config/axios.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Axios, {
|
|
1
|
+
import Axios, { InternalAxiosRequestConfig } from 'axios'
|
|
2
2
|
import Cookies from 'js-cookie'
|
|
3
3
|
import { toast } from 'react-toastify'
|
|
4
4
|
import { NetworkStore } from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
@@ -34,7 +34,7 @@ let axios = Axios.create({
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
axios.interceptors.request.use(
|
|
37
|
-
function (config:
|
|
37
|
+
function (config: InternalAxiosRequestConfig) {
|
|
38
38
|
const params = formatParams(config?.params)
|
|
39
39
|
NetworkStore.update((s) => {
|
|
40
40
|
s.loading = true
|
package/src/hooks/useAuth.ts
CHANGED
|
@@ -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 = ({
|