@campxdev/shared 1.2.3 → 1.2.5

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.2.3",
3
+ "version": "1.2.5",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -1,4 +1,5 @@
1
1
  import { Box, Menu, Typography } from '@mui/material'
2
+ import Cookies from 'js-cookie'
2
3
  import { useState } from 'react'
3
4
  import { applications } from './applications'
4
5
  import { AppsIcon } from './icons'
@@ -10,6 +11,8 @@ import {
10
11
  StyledLink,
11
12
  } from './styles'
12
13
 
14
+ export const campxTenantKey = Cookies.get('campx_tenant')
15
+
13
16
  const AppsMenu = () => {
14
17
  const [anchorEl, setAnchorEl] = useState<any>(null)
15
18
  const open = Boolean(anchorEl)
@@ -55,7 +58,10 @@ const AppsMenu = () => {
55
58
  </Box>
56
59
  <Box>
57
60
  {applications.map((item, index) => (
58
- <StyledLink href={item.path} key={index}>
61
+ <StyledLink
62
+ href={item.path + `/${campxTenantKey ?? ''}`}
63
+ key={index}
64
+ >
59
65
  <StyledMenuItemContainer
60
66
  key={index}
61
67
  onClick={() => {
@@ -40,7 +40,7 @@ export function LoginForm({ loginUrl }: { loginUrl?: string }) {
40
40
  method: 'POST',
41
41
  url: loginUrl
42
42
  ? loginUrl
43
- : 'https://api.campx.dev/auth-server/auth/login',
43
+ : `https://api.campx.dev/auth-server/auth/login`,
44
44
  data: values,
45
45
  })
46
46
  Cookies.set('campx_tenant', res?.data?.subDomain)
@@ -18,7 +18,7 @@ export default function Providers({ children }: { children: ReactNode }) {
18
18
  const [isInvalid, setIsInvalid] = useState(false)
19
19
 
20
20
  useEffect(() => {
21
- if (campxTenantKey === 'campx_dev' && !urlTenantKey) {
21
+ if (campxTenantKey === 'campx_dev') {
22
22
  window.location.href = window.location.origin + '/campx_dev'
23
23
  }
24
24
 
@@ -36,7 +36,7 @@ export default function Providers({ children }: { children: ReactNode }) {
36
36
  }, [])
37
37
 
38
38
  return (
39
- <BrowserRouter basename={isDevelopment ? 'campx_dev' : urlTenantKey}>
39
+ <BrowserRouter basename={urlTenantKey}>
40
40
  <QueryClientProvider>
41
41
  <MuiThemeProvider>
42
42
  <ConfirmContextProvider>