@campxdev/shared 1.11.7-0.alpha.52 → 1.11.7-0.alpha.53

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-0.alpha.52",
3
+ "version": "1.11.7-0.alpha.53",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -95,37 +95,6 @@ function handleInstitutions(institutions) {
95
95
  }
96
96
  }
97
97
 
98
- const loginErrorHandler = ({
99
- loginUrl,
100
- setLoading,
101
- err,
102
- }: {
103
- loginUrl: string
104
- setLoading?: any
105
- err: AxiosError
106
- }) => {
107
- const navigate = useNavigate()
108
- setLoading && setLoading(false)
109
- const origin = window.location.origin
110
- const isStaging = origin.split('campx')[1] === '.dev'
111
-
112
- if (isDevelopment || isStaging) {
113
- openRootModal({
114
- key: 'login',
115
- contentData: {
116
- loginUrl,
117
- },
118
- dialogProps: {
119
- disableEscapeKeyDown: true,
120
- onClose: () => {},
121
- },
122
- })
123
- return
124
- } else {
125
- navigate('/auth/login')
126
- }
127
- }
128
-
129
98
  function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
130
99
  const [loading, setLoading] = useState<boolean>(false)
131
100
  const [data, setData] = useState(null)
@@ -185,7 +154,26 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
185
154
  setLoading(false)
186
155
  })
187
156
  .catch((err: AxiosError) => {
188
- loginErrorHandler({ loginUrl, setLoading, err })
157
+ const navigate = useNavigate()
158
+ setLoading && setLoading(false)
159
+ const origin = window.location.origin
160
+ const isStaging = origin.split('campx')[1] === '.dev'
161
+
162
+ if (isDevelopment || isStaging) {
163
+ openRootModal({
164
+ key: 'login',
165
+ contentData: {
166
+ loginUrl,
167
+ },
168
+ dialogProps: {
169
+ disableEscapeKeyDown: true,
170
+ onClose: () => {},
171
+ },
172
+ })
173
+ return
174
+ } else {
175
+ navigate('/auth/login')
176
+ }
189
177
  })
190
178
  }
191
179