@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.11.7-1.alpha.4",
3
+ "version": "1.11.7-1.alpha.6",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -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
- Cookies.set('campx_institution', res.data?.institutionCode)
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)
@@ -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 tenantId =
8
- Cookies.get('campx_tenant') ?? window.location.hostname.split('.')[0]
9
- const institutionId =
10
- Cookies.get('campx_institution') ?? window.location.pathname.split('/')[1]
11
- const openPaymentsKey = Cookies.get('campx_open_payments_key')
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 isProduction = process.env.NODE_ENV === 'production'
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': tenantId,
31
- 'x-institution-code': institutionId,
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')