@qlibs/utils 1.14.4 → 1.14.7
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.
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
+
export type BreadcrumbItem = {
|
|
3
|
+
field: string;
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
2
7
|
export type AuthenticatedProps = {
|
|
3
8
|
authHeader: string;
|
|
4
9
|
authUser: {
|
|
@@ -10,4 +15,6 @@ export type AuthenticatedProps = {
|
|
|
10
15
|
};
|
|
11
16
|
httpRequest: AxiosInstance;
|
|
12
17
|
httpRequestMultipartFormData: AxiosInstance;
|
|
18
|
+
breadcrumbDetails?: BreadcrumbItem[];
|
|
19
|
+
setBreadcrumbDetails?: (items: BreadcrumbItem[]) => void;
|
|
13
20
|
};
|
package/dist/utils/axios.js
CHANGED
|
@@ -58,9 +58,24 @@ function handleNoAuth(errorResponse, Modal) {
|
|
|
58
58
|
if (errorResponse.status === 403) {
|
|
59
59
|
title = 'Forbidden';
|
|
60
60
|
content = `You don't have permission. Please contact administrator.`;
|
|
61
|
+
Modal.error({
|
|
62
|
+
className: 'noauth_401403',
|
|
63
|
+
title,
|
|
64
|
+
content,
|
|
65
|
+
footer: null,
|
|
66
|
+
});
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
Modal.destroyAll();
|
|
69
|
+
if (window.location.pathname.includes('my-')) {
|
|
70
|
+
window.location.href = '/my-dashboard';
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
window.location.href = '/dashboard';
|
|
74
|
+
}
|
|
75
|
+
}, 1000);
|
|
61
76
|
}
|
|
62
77
|
else if (errorResponse.status === 401) {
|
|
63
|
-
title = '
|
|
78
|
+
title = 'Login Required';
|
|
64
79
|
content = `Please login to continue`;
|
|
65
80
|
}
|
|
66
81
|
else if (((_b = errorResponse.data) === null || _b === void 0 ? void 0 : _b.code) === 'err_unauthorized') {
|