@veritree/services 2.82.4 → 2.84.0

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": "@veritree/services",
3
- "version": "2.82.4",
3
+ "version": "2.84.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,5 +1,27 @@
1
+ /**
2
+ * Retrieves the current user session from browser storage.
3
+ * Checks localStorage first, then falls back to sessionStorage.
4
+ *
5
+ * @returns {Object} The parsed session object, or an empty object if no session exists or parsing fails
6
+ */
1
7
  export const getSession = () => {
2
- return JSON.parse(localStorage.getItem("session") || "{}");
8
+ try {
9
+ const localSession = localStorage.getItem("session");
10
+
11
+ if (localSession) {
12
+ return JSON.parse(localSession);
13
+ }
14
+
15
+ const sessionSession = sessionStorage.getItem("veritree-tab-session");
16
+
17
+ if (sessionSession) {
18
+ return JSON.parse(sessionSession);
19
+ }
20
+ } catch (error) {
21
+ console.error("Failed to parse session data:", error);
22
+ }
23
+
24
+ return {};
3
25
  };
4
26
 
5
27
  export const getMe = () => {