@campxdev/shared 1.2.7 → 1.2.9
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/exports.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './src/components'
|
|
|
2
2
|
export * from './src/constants'
|
|
3
3
|
export { default as axios, axiosErrorToast } from './src/config/axios'
|
|
4
4
|
export { default as axiosTenant } from './src/config/axiosXTenant'
|
|
5
|
+
export { default as axiosEvaluator } from './src/config/axiosEvaluator'
|
|
5
6
|
|
|
6
7
|
export * from './src/permissions'
|
|
7
8
|
export * from './src/utils'
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export default function ChangePassword({ close }) {
|
|
|
9
9
|
|
|
10
10
|
const onSubmit = async (formData) => {
|
|
11
11
|
try {
|
|
12
|
-
await axios.post('/auth/change-password', formData)
|
|
12
|
+
await axios.post('/auth-server/auth/change-password', formData)
|
|
13
13
|
toast.success('Password Changed Successfully')
|
|
14
14
|
} catch (error) {
|
|
15
15
|
axiosErrorToast(error)
|
|
@@ -104,7 +104,7 @@ const DropDownMenu = ({ path, title, icon, menuItems }) => {
|
|
|
104
104
|
const validateDropdownAccess = () => {
|
|
105
105
|
if (process.env.NODE_ENV === 'development' && !permissions) return true
|
|
106
106
|
|
|
107
|
-
return menuItems?.
|
|
107
|
+
return menuItems?.some((item) =>
|
|
108
108
|
item?.permissionKey ? permissions[item.permissionKey] : accessIfNoKey,
|
|
109
109
|
)
|
|
110
110
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Axios from 'axios'
|
|
2
|
+
import Cookies from 'js-cookie'
|
|
3
|
+
import { NetworkStore } from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
4
|
+
import { isDevelopment } from '../constants'
|
|
5
|
+
import { formatParams } from './axios'
|
|
6
|
+
|
|
7
|
+
// const sessionKey = Cookies.get('campx_session_key')
|
|
8
|
+
const clientId = window.location.pathname.split('/')[1] ?? 'campx_dev'
|
|
9
|
+
const evaluatorKey = Cookies.get('campx_evaluator_key')
|
|
10
|
+
|
|
11
|
+
const axiosEvaluator = Axios.create({
|
|
12
|
+
baseURL: process.env.REACT_APP_API_HOST,
|
|
13
|
+
withCredentials: true,
|
|
14
|
+
headers: {
|
|
15
|
+
'x-tenant-id': clientId,
|
|
16
|
+
...(evaluatorKey && {
|
|
17
|
+
campx_evaluator_key: evaluatorKey,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
axiosEvaluator.interceptors.request.use(
|
|
23
|
+
function (config) {
|
|
24
|
+
const params = formatParams(config?.params)
|
|
25
|
+
NetworkStore.update((s) => {
|
|
26
|
+
s.loading = true
|
|
27
|
+
})
|
|
28
|
+
return { ...config, params }
|
|
29
|
+
},
|
|
30
|
+
function (error) {
|
|
31
|
+
NetworkStore.update((s) => {
|
|
32
|
+
s.loading = false
|
|
33
|
+
})
|
|
34
|
+
return Promise.reject(error)
|
|
35
|
+
},
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
axiosEvaluator.interceptors.response.use(
|
|
39
|
+
function (response) {
|
|
40
|
+
NetworkStore.update((s) => {
|
|
41
|
+
s.loading = false
|
|
42
|
+
})
|
|
43
|
+
return response
|
|
44
|
+
},
|
|
45
|
+
function (err) {
|
|
46
|
+
NetworkStore.update((s) => {
|
|
47
|
+
s.loading = false
|
|
48
|
+
})
|
|
49
|
+
return Promise.reject(err)
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
export default axiosEvaluator
|