hrm_ui_lib 3.0.5 → 3.0.6
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/consts/index.d.ts +11 -0
- package/consts/index.js +12 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/helpers/logout.d.ts +1 -0
- package/helpers/logout.js +8 -0
- package/package.json +1 -1
- package/utils/helpers.d.ts +1 -0
- package/utils/helpers.js +6 -0
package/consts/index.d.ts
CHANGED
|
@@ -27,3 +27,14 @@ export declare const FILE_ACCEPT_TYPE: {
|
|
|
27
27
|
IMAGE: string[];
|
|
28
28
|
DOC: string[];
|
|
29
29
|
};
|
|
30
|
+
export declare enum STORE_KEYS {
|
|
31
|
+
selectedLanguage = "selectedLanguage",
|
|
32
|
+
userActiveRole = "userActiveRole",
|
|
33
|
+
roleInfo = "roleInfo",
|
|
34
|
+
userInfo = "userInfo",
|
|
35
|
+
navigationInfo = "navigationInfo",
|
|
36
|
+
isNavMenuExpanded = "isNavMenuExpanded",
|
|
37
|
+
isAuthenticated = "isAuthenticated",
|
|
38
|
+
personId = "personId",
|
|
39
|
+
isMobile = "isMobile"
|
|
40
|
+
}
|
package/consts/index.js
CHANGED
|
@@ -86,3 +86,15 @@ export const FILE_ACCEPT_TYPE = {
|
|
|
86
86
|
'.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
87
87
|
]
|
|
88
88
|
};
|
|
89
|
+
export var STORE_KEYS;
|
|
90
|
+
(function (STORE_KEYS) {
|
|
91
|
+
STORE_KEYS["selectedLanguage"] = "selectedLanguage";
|
|
92
|
+
STORE_KEYS["userActiveRole"] = "userActiveRole";
|
|
93
|
+
STORE_KEYS["roleInfo"] = "roleInfo";
|
|
94
|
+
STORE_KEYS["userInfo"] = "userInfo";
|
|
95
|
+
STORE_KEYS["navigationInfo"] = "navigationInfo";
|
|
96
|
+
STORE_KEYS["isNavMenuExpanded"] = "isNavMenuExpanded";
|
|
97
|
+
STORE_KEYS["isAuthenticated"] = "isAuthenticated";
|
|
98
|
+
STORE_KEYS["personId"] = "personId";
|
|
99
|
+
STORE_KEYS["isMobile"] = "isMobile";
|
|
100
|
+
})(STORE_KEYS || (STORE_KEYS = {}));
|
package/helpers/index.d.ts
CHANGED
package/helpers/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logout: (path?: string) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { clearStorage } from '../utils/helpers';
|
|
2
|
+
import { getModulePrefix } from './get-module-prefix';
|
|
3
|
+
export const logout = (path = '/auth/logout') => {
|
|
4
|
+
clearStorage();
|
|
5
|
+
const currentUrl = `${window.location.pathname}${window.location.search}`;
|
|
6
|
+
const encodedReturnUrl = encodeURIComponent(currentUrl);
|
|
7
|
+
window.location.href = `${getModulePrefix()}${path}?returnUrl=${encodedReturnUrl}`;
|
|
8
|
+
};
|
package/package.json
CHANGED
package/utils/helpers.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export declare const setTranslationValue: (translation: string, value: string |
|
|
|
13
13
|
export declare const getYearOptions: (startYear: number, lastYear: number) => TSelectOptions;
|
|
14
14
|
export declare const isSameDay: (date1?: Date, date2?: Date) => boolean;
|
|
15
15
|
export declare const generateDataTestId: (postfix: string, dataId?: string) => string;
|
|
16
|
+
export declare const clearStorage: () => void;
|
package/utils/helpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
import { STORE_KEYS } from '../consts';
|
|
2
3
|
export const noop = () => {
|
|
3
4
|
return undefined;
|
|
4
5
|
};
|
|
@@ -73,3 +74,8 @@ export const generateDataTestId = (postfix, dataId) => {
|
|
|
73
74
|
}
|
|
74
75
|
return `${dataId}-${postfix}`;
|
|
75
76
|
};
|
|
77
|
+
export const clearStorage = () => {
|
|
78
|
+
for (const key in STORE_KEYS) {
|
|
79
|
+
localStorage.removeItem(key);
|
|
80
|
+
}
|
|
81
|
+
};
|