@campxdev/shared 3.1.3-alpha2 → 3.1.3-alpha4

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": "3.1.3-alpha2",
3
+ "version": "3.1.3-alpha4",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -24,6 +24,7 @@ const workspaceApiMapping: Record<string, string> = {
24
24
  'academic-admin-workspace': '/academic-admin-api',
25
25
  'hostel-admin-workspace': '/hostel-admin-api',
26
26
  'transport-coordinator-workspace': '/transport-coordinator-api',
27
+ 'employee-workspace': '/employee-api',
27
28
  }
28
29
 
29
30
  export const formatParams = (params) => {
@@ -58,8 +59,15 @@ axios.interceptors.request.use(
58
59
  window.location.pathname.split('/')[2] !== 'common-workspace' &&
59
60
  workspaceApiMapping[window.location.pathname.split('/')[2]]
60
61
  ) {
61
- const workspacePrefix = workspaceApiMapping[window.location.pathname.split('/')[2]]
62
- config.url = `${workspacePrefix}${config.url}`
62
+ const workspacePrefix =
63
+ workspaceApiMapping[window.location.pathname.split('/')[2]]
64
+ if (
65
+ workspacePrefix &&
66
+ typeof workspacePrefix === 'string' &&
67
+ workspacePrefix.trim()
68
+ ) {
69
+ config.url = `${workspacePrefix}${config.url}`
70
+ }
63
71
  }
64
72
 
65
73
  // Add session keys from cookies if available
@@ -104,7 +104,7 @@ const useAuth = ({
104
104
 
105
105
  const appInit = async () => {
106
106
  try {
107
- const res = await axios.get(permissionsEndpoint)
107
+ const res = await axios.get(permissionsEndpoint, { workspace: false })
108
108
  const isAdmin = checkIsAdmin(res.data.user)
109
109
  setLoading(false)
110
110
  setData(res.data)