@campxdev/shared 1.11.7-1.alpha.4 → 1.11.7-1.alpha.6
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
|
@@ -61,10 +61,9 @@ export function LoginForm({
|
|
|
61
61
|
...deviceState.deviceInformation,
|
|
62
62
|
},
|
|
63
63
|
})
|
|
64
|
-
Cookies.set('campx_tenant', res?.data?.subDomain)
|
|
65
64
|
Cookies.set('campx_session_key', res.data?.token)
|
|
66
|
-
|
|
67
|
-
window.location.reload()
|
|
65
|
+
window.location.href = `/${res.data.subDomain}/${res.data.institutionCode}`
|
|
66
|
+
//window.location.reload()
|
|
68
67
|
} catch (err) {
|
|
69
68
|
// eslint-disable-next-line no-console
|
|
70
69
|
console.log(err)
|
package/src/config/axios.ts
CHANGED
|
@@ -3,14 +3,17 @@ import Cookies from 'js-cookie'
|
|
|
3
3
|
import { toast } from 'react-toastify'
|
|
4
4
|
import { NetworkStore } from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
5
5
|
|
|
6
|
+
const isDevelopment = process.env.NODE_ENV == 'development'
|
|
7
|
+
|
|
6
8
|
const sessionKey = Cookies.get('campx_session_key')
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const tenantCode = isDevelopment
|
|
10
|
+
? window.location.pathname.split('/')[1]
|
|
11
|
+
: window.location.hostname.split('.')[0]
|
|
12
|
+
const institutionCode = isDevelopment
|
|
13
|
+
? window.location.pathname.split('/')[2]
|
|
14
|
+
: window.location.pathname.split('/')[1]
|
|
12
15
|
|
|
13
|
-
const
|
|
16
|
+
const openPaymentsKey = Cookies.get('campx_open_payments_key')
|
|
14
17
|
|
|
15
18
|
export const formatParams = (params) => {
|
|
16
19
|
return Object.fromEntries(
|
|
@@ -21,15 +24,16 @@ export const formatParams = (params) => {
|
|
|
21
24
|
)
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
console.log(institutionId, sessionKey, 'test')
|
|
25
|
-
|
|
26
27
|
let axios = Axios.create({
|
|
27
28
|
baseURL: process.env.REACT_APP_API_HOST,
|
|
28
29
|
withCredentials: true,
|
|
29
30
|
headers: {
|
|
30
|
-
'x-tenant-id':
|
|
31
|
-
'x-institution-code':
|
|
31
|
+
'x-tenant-id': tenantCode,
|
|
32
|
+
'x-institution-code': institutionCode,
|
|
32
33
|
campx_session_key: sessionKey,
|
|
34
|
+
...(openPaymentsKey && {
|
|
35
|
+
campx_open_payments_key: openPaymentsKey,
|
|
36
|
+
}),
|
|
33
37
|
},
|
|
34
38
|
})
|
|
35
39
|
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export const isDevelopment =
|
|
2
|
-
process.env.NODE_ENV === 'development' ||
|
|
3
|
-
window.location.origin.split('campx')[1] === '.dev'
|
|
4
|
-
|
|
1
|
+
export const isDevelopment = process.env.NODE_ENV === 'development'
|
|
5
2
|
export const isSetup = window.location.hostname.split('.').includes('setup')
|