@syzy/apphost 1.0.21 → 1.0.22

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.
@@ -52,7 +52,7 @@ export function withSyzyAuth(WrappedComponent) {
52
52
  const { userMappingByUserId } = useGetUserMappingByUserId(currentUser ?? "");
53
53
  useEffect(() => {
54
54
  const updateSession = async () => {
55
- if (!currentUser)
55
+ if (!currentUser || !userMappingByUserId)
56
56
  return;
57
57
  const branchId = userMappingByUserId?.pk ?? "";
58
58
  // Fetch roles of this user
@@ -10,6 +10,7 @@ export const useSessionReducer = (reducer, initialState, storageKey) => {
10
10
  return retState;
11
11
  });
12
12
  useEffect(() => {
13
+ console.log("Saving session to localStorage", state);
13
14
  localStorage.setItem(storageKey, JSON.stringify(state)); // same key
14
15
  }, [storageKey, state]);
15
16
  return [state, dispatch];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syzy/apphost",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",