@campxdev/shared 1.8.49-alpha.6 → 1.8.49-alpha.8
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,18 +1,8 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
|
-
import Image from '../Image/Image'
|
|
3
|
-
import axios from '../../config/axios'
|
|
4
|
-
import { useQuery } from 'react-query'
|
|
5
|
-
import Spinner from '../Spinner'
|
|
6
|
-
import { institutions } from './services'
|
|
7
2
|
import { InsititutionsStore } from '../../shared-state/InstitutionsStore'
|
|
3
|
+
import Image from '../Image/Image'
|
|
8
4
|
|
|
9
5
|
export default function InsititutionsDialog({ close }) {
|
|
10
|
-
// const { data, isLoading } = useQuery(
|
|
11
|
-
// 'institutions',
|
|
12
|
-
// institutions.fetchInsititutions,
|
|
13
|
-
// )
|
|
14
|
-
|
|
15
|
-
// if (isLoading) return <Spinner />
|
|
16
6
|
const { institutions } = InsititutionsStore.useState((s) => s)
|
|
17
7
|
|
|
18
8
|
return (
|
|
@@ -47,11 +47,11 @@ export default function UploadButton({
|
|
|
47
47
|
fileName: res.data?.mediaObject?.originalFileName ?? '',
|
|
48
48
|
id: res.data?.mediaObject?.id ?? '',
|
|
49
49
|
})
|
|
50
|
-
refetchFn()
|
|
50
|
+
refetchFn && refetchFn()
|
|
51
51
|
setLoading(false)
|
|
52
52
|
loadingState && loadingState(false)
|
|
53
53
|
if (onSuccess) onSuccess()
|
|
54
|
-
formRef?.current
|
|
54
|
+
!styledUpload && formRef?.current?.reset()
|
|
55
55
|
})
|
|
56
56
|
.catch((err) => {
|
|
57
57
|
setLoading(false)
|
|
@@ -59,7 +59,7 @@ export default function UploadButton({
|
|
|
59
59
|
toast.error(
|
|
60
60
|
err?.response?.data?.message ?? 'Server Error While Uploading File',
|
|
61
61
|
)
|
|
62
|
-
!styledUpload && formRef?.current
|
|
62
|
+
!styledUpload && formRef?.current?.reset()
|
|
63
63
|
})
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/hooks/useAuth.ts
CHANGED
|
@@ -96,6 +96,11 @@ function handleInstitutions(institutions) {
|
|
|
96
96
|
`${window.location.origin}/${urlTenantKey}/${institutions[0]?.code}`,
|
|
97
97
|
)
|
|
98
98
|
}
|
|
99
|
+
if (insititutionKey !== institutions[0]?.code) {
|
|
100
|
+
window.location.replace(
|
|
101
|
+
`${window.location.origin}/${urlTenantKey}/${institutions[0]?.code}`,
|
|
102
|
+
)
|
|
103
|
+
}
|
|
99
104
|
InsititutionsStore.update((s) => {
|
|
100
105
|
s.current = institutions[0]
|
|
101
106
|
s.institutions = institutions
|
|
@@ -111,6 +116,18 @@ function handleInstitutions(institutions) {
|
|
|
111
116
|
},
|
|
112
117
|
})
|
|
113
118
|
}
|
|
119
|
+
if (
|
|
120
|
+
insititutionKey &&
|
|
121
|
+
!institutions?.find((item) => item.code === insititutionKey)
|
|
122
|
+
) {
|
|
123
|
+
openRootModal({
|
|
124
|
+
key: 'institutions',
|
|
125
|
+
dialogProps: {
|
|
126
|
+
disableEscapeKeyDown: true,
|
|
127
|
+
onClose: () => {},
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
}
|
|
114
131
|
InsititutionsStore.update((s) => {
|
|
115
132
|
s.institutions = institutions
|
|
116
133
|
s.current = institutions.find((item) => item.code === insititutionKey)
|
|
@@ -181,8 +198,8 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
181
198
|
}
|
|
182
199
|
}
|
|
183
200
|
|
|
184
|
-
if (res.data?.
|
|
185
|
-
handleInstitutions(res.data?.
|
|
201
|
+
if (res.data?.institutions) {
|
|
202
|
+
handleInstitutions(res.data?.institutions)
|
|
186
203
|
}
|
|
187
204
|
|
|
188
205
|
setData(res.data)
|